Skip to content

Commit 2bf1c45

Browse files
osmtenbroonie
authored andcommitted
regulator: Fix error checking for debugfs_create_dir
This patch fixes the error checking in core.c in debugfs_create_dir. The correct way to check if an error occurred is 'IS_ERR' inline function. Signed-off-by: Osama Muhammad <[email protected] Suggested-by: Ivan Orlov <[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]
1 parent d67dada commit 2bf1c45

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/regulator/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5256,7 +5256,7 @@ static void rdev_init_debugfs(struct regulator_dev *rdev)
52565256
}
52575257

52585258
rdev->debugfs = debugfs_create_dir(rname, debugfs_root);
5259-
if (!rdev->debugfs) {
5259+
if (IS_ERR(rdev->debugfs)) {
52605260
rdev_warn(rdev, "Failed to create debugfs directory\n");
52615261
return;
52625262
}
@@ -6178,7 +6178,7 @@ static int __init regulator_init(void)
61786178
ret = class_register(&regulator_class);
61796179

61806180
debugfs_root = debugfs_create_dir("regulator", NULL);
6181-
if (!debugfs_root)
6181+
if (IS_ERR(debugfs_root))
61826182
pr_warn("regulator: Failed to create debugfs directory\n");
61836183

61846184
#ifdef CONFIG_DEBUG_FS

0 commit comments

Comments
 (0)