[PATCH v1] drivers: fix parameter check in create_debugfs_nodes()

From: Minjie Du
Date: Wed Jul 12 2023 - 08:07:16 EST


Make IS_ERR() judge the debugfs_create_dir() function return
in create_debugfs_nodes()

Signed-off-by: Minjie Du <duminjie@xxxxxxxx>
---
drivers/ras/cec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
index 321af498e..27db1ae9f 100644
--- a/drivers/ras/cec.c
+++ b/drivers/ras/cec.c
@@ -483,7 +483,7 @@ static int __init create_debugfs_nodes(void)
struct dentry *d, *pfn, *decay, *count, *array;

d = debugfs_create_dir("cec", ras_debugfs_dir);
- if (!d) {
+ if (IS_ERR(d)) {
pr_warn("Error creating cec debugfs node!\n");
return -1;
}
--
2.39.0