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 <osmtendev@gmail.com Suggested-by: Ivan Orlov <ivan.orlov0322@gmail.com Link: https://lore.kernel.org/r/20230515172938.13338-1-osmtendev@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org
1 parent d67dada commit 2bf1c45

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

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)