Skip to contentSkip to conversation

lib: fix two parameters check in ei_debugfs_init()

PATCH In review Minjie Du 2 participants 2 messages Jul 12, 2023

Subsystems (2)
lore
Share & tools
lore

Minjie Du

author
#0 lore raw

PATCH 1/1 lib: fix two parameters check in ei_debugfs_init()

Make IS_ERR() judge the debugfs_create_dir() function return in ei_debugfs_init().

---
 lib/error-inject.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/error-inject.c +2 -2
index 32c147705..9dd2c5ca3 100644
@@ -217,11 +217,11 @@ static int __init ei_debugfs_init(void)
 	struct dentry *dir, *file;
 
 	dir = debugfs_create_dir("error_injection", NULL);
-	if (!dir)
+	if (IS_ERR(dir))
 		return -ENOMEM;
 
 	file = debugfs_create_file("list", 0444, dir, NULL, &ei_fops);
-	if (!file) {
+	if (IS_ERR(file)) {
 		debugfs_remove(dir);
 		return -ENOMEM;
 	}
Signature · 1 line
2.39.0
#1 lore raw
Quoted 2 lines

Make IS_ERR() judge the debugfs_create_dir() function return in ei_debugfs_init().

Would a subject like “[PATCH v2] lib/error-inject: Fix checks for two variables in ei_debugfs_init()” be more appropriate?

Regards,
Markus