[PATCH v1] drivers:bus:Fix the NULL vs IS_ERR() bug for debugfs_create_dir()

Yang Ruibin 11162571 at vivo.com
Wed Aug 21 04:21:30 PDT 2024


The debugfs_create_dir() function returns error pointers.
It never returns NULL. So use IS_ERR() to check it.

Signed-off-by: Yang Ruibin <11162571 at vivo.com>
---
 drivers/bus/mvebu-mbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index 3c99d72087eb..42621838ba75 100644
--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -995,13 +995,13 @@ static __init int mvebu_mbus_debugfs_init(void)
 	s->debugfs_root = debugfs_create_dir("mvebu-mbus", NULL);
 	if(IS_ERR(s->debugfs_root))
 		return PTR_ERR(s->debugfs_root);
+
 	s->debugfs_sdram = debugfs_create_file("sdram", S_IRUGO,
 							s->debugfs_root, NULL,
 							&mvebu_sdram_debug_fops);
 	s->debugfs_devs = debugfs_create_file("devices", S_IRUGO,
 							s->debugfs_root, NULL,
 							&mvebu_devs_debug_fops);
-	}
 
 	return 0;
 }
-- 
2.34.1




More information about the linux-arm-kernel mailing list