Skip to contentSkip to conversation

mailbox:Fix error checking for debugfs_create_dir() in mbox_test_add_debugfs()

PATCH New Wang Ming 1 participant 1 message Jul 12, 2023 Mailbox API

lore
Share & tools
lore

Wang Ming

author
#0 lore raw

PATCH 1/1 mailbox:Fix error checking for debugfs_create_dir() in mbox_test_add_debugfs()

In case of failure, debugfs_create_dir() does not return NULL, but an error pointer. Most incorrect error checks were fixed,but the one in mbox_test_add_debugfs() was forgotten.

---
 drivers/mailbox/mailbox-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mailbox/mailbox-test.c +1 -1
index fc6a12a51b40..ae9861c57fb1 100644
@@ -268,7 +268,7 @@ static int mbox_test_add_debugfs(struct platform_device *pdev,
 		return 0;
 
 	tdev->root_debugfs_dir = debugfs_create_dir(dev_name(&pdev->dev), NULL);
-	if (!tdev->root_debugfs_dir) {
+	if (IS_ERR(tdev->root_debugfs_dir)) {
 		dev_err(&pdev->dev, "Failed to create Mailbox debugfs\n");
 		return -EINVAL;
 	}
Signature · 1 line
2.25.1