Skip to content

Commit

Permalink
regulator: Fix error checking for debugfs_create_dir
Browse files Browse the repository at this point in the history
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
  • Loading branch information
osmten authored and broonie committed May 16, 2023
1 parent d67dada commit 2bf1c45
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -5256,7 +5256,7 @@ static void rdev_init_debugfs(struct regulator_dev *rdev)
}

rdev->debugfs = debugfs_create_dir(rname, debugfs_root);
if (!rdev->debugfs) {
if (IS_ERR(rdev->debugfs)) {
rdev_warn(rdev, "Failed to create debugfs directory\n");
return;
}
Expand Down Expand Up @@ -6178,7 +6178,7 @@ static int __init regulator_init(void)
ret = class_register(&regulator_class);

debugfs_root = debugfs_create_dir("regulator", NULL);
if (!debugfs_root)
if (IS_ERR(debugfs_root))
pr_warn("regulator: Failed to create debugfs directory\n");

#ifdef CONFIG_DEBUG_FS
Expand Down

0 comments on commit 2bf1c45

Please sign in to comment.