diff options
author | Osama Muhammad <osmtendev@gmail.com> | 2023-05-15 20:29:38 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-06-21 16:39:56 +0300 |
commit | 5ee480645fcfe40a4afb8ad876f9764f163f27ca (patch) | |
tree | 874f525dd7de191b67750fd0e27a5300e50a707f | |
parent | 417bd5473eb2c9671ac2465a71154871c307f552 (diff) | |
download | linux-5ee480645fcfe40a4afb8ad876f9764f163f27ca.tar.xz |
regulator: Fix error checking for debugfs_create_dir
[ Upstream commit 2bf1c45be3b8f3a3f898d0756c1282f09719debd ]
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
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/regulator/core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 11656b383674..14f9977f1ec0 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -4181,7 +4181,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; } @@ -4843,7 +4843,7 @@ static int __init regulator_init(void) ret = class_register(®ulator_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"); debugfs_create_file("supply_map", 0444, debugfs_root, NULL, |