Skip to contentSkip to conversation

ras:debugfs.c: Fix error checking for debugfs_create_dir

PATCH Applied Osama Muhammad 2 participants 2 messages May 16, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ras:debugfs.c: Fix error checking for debugfs_create_dir

This patch fixes the error checking in debugfs.c in debugfs_create_dir. The correct way to check if an error occurred is 'IS_ERR' inline function.

---
 drivers/ras/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ras/debugfs.c +1 -1
index f0a6391b1146..ffb973c328e3 100644
@@ -46,7 +46,7 @@ int __init ras_add_daemon_trace(void)
 
 	fentry = debugfs_create_file("daemon_active", S_IRUSR, ras_debugfs_dir,
 				     NULL, &trace_fops);
-	if (!fentry)
+	if (IS_ERR(fentry))
 		return -ENODEV;
 
 	return 0;
Signature · 1 line
2.34.1
merge bot Applied
#1 lore raw

[tip: ras/core] ras/debugfs: Fix error checking for debugfs_create_dir()

The following commit has been merged into the ras/core branch of tip:

The following commit has been merged into the ras/core branch of tip:

Commit-ID:     2a1d18a5dc5056825b8e9527d188130da6256efc
Gitweb:        https://git.kernel.org/tip/2a1d18a5dc5056825b8e9527d188130da6256efc
Author:        Osama Muhammad <[email protected]>
AuthorDate:    Tue, 16 May 2023 23:29:27 +05:00
Committer:     Borislav Petkov (AMD) <[email protected]>
CommitterDate: Tue, 16 May 2023 21:12:23 +02:00

ras/debugfs: Fix error checking for debugfs_create_dir()

Check the return value of debugfs_create_dir() properly.

[ bp: Rewrite commit message. ]

---
 drivers/ras/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ras/debugfs.c +1 -1
index f0a6391..ffb973c 100644
@@ -46,7 +46,7 @@ int __init ras_add_daemon_trace(void)
 
 	fentry = debugfs_create_file("daemon_active", S_IRUSR, ras_debugfs_dir,
 				     NULL, &trace_fops);
-	if (!fentry)
+	if (IS_ERR(fentry))
 		return -ENODEV;
 
 	return 0;