diff options
author | Mark Brown <broonie@kernel.org> | 2023-05-30 18:29:12 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-05-30 18:29:12 +0300 |
commit | 9defeb9f0a2a036e58fc4314fcfe64ac286e74f0 (patch) | |
tree | cb51e6cbe87880ab3e5bf1f7de86579a81529e62 /drivers/regulator | |
parent | 87fe0214d7aae5e1152953710489c5ab5469b388 (diff) | |
parent | 08880713ceec023dd94d634f1e8902728c385939 (diff) | |
download | linux-9defeb9f0a2a036e58fc4314fcfe64ac286e74f0.tar.xz |
regulator: core: Fix error checking and messages
Merge series from Geert Uytterhoeven <geert+renesas@glider.be>:
This patch series corrects an error check, fixes error messages when
debugfs is not enabled, and improves debugfs error handling in the
regulator core.
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/core.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 698ab7f5004b..d8e1caaf207e 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1911,19 +1911,17 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, if (err != -EEXIST) regulator->debugfs = debugfs_create_dir(supply_name, rdev->debugfs); - if (!regulator->debugfs) { + if (IS_ERR(regulator->debugfs)) rdev_dbg(rdev, "Failed to create debugfs directory\n"); - } else { - debugfs_create_u32("uA_load", 0444, regulator->debugfs, - ®ulator->uA_load); - debugfs_create_u32("min_uV", 0444, regulator->debugfs, - ®ulator->voltage[PM_SUSPEND_ON].min_uV); - debugfs_create_u32("max_uV", 0444, regulator->debugfs, - ®ulator->voltage[PM_SUSPEND_ON].max_uV); - debugfs_create_file("constraint_flags", 0444, - regulator->debugfs, regulator, - &constraint_flags_fops); - } + + debugfs_create_u32("uA_load", 0444, regulator->debugfs, + ®ulator->uA_load); + debugfs_create_u32("min_uV", 0444, regulator->debugfs, + ®ulator->voltage[PM_SUSPEND_ON].min_uV); + debugfs_create_u32("max_uV", 0444, regulator->debugfs, + ®ulator->voltage[PM_SUSPEND_ON].max_uV); + debugfs_create_file("constraint_flags", 0444, regulator->debugfs, + regulator, &constraint_flags_fops); /* * Check now if the regulator is an always on regulator - if @@ -5256,10 +5254,8 @@ static void rdev_init_debugfs(struct regulator_dev *rdev) } rdev->debugfs = debugfs_create_dir(rname, debugfs_root); - if (IS_ERR(rdev->debugfs)) { - rdev_warn(rdev, "Failed to create debugfs directory\n"); - return; - } + if (IS_ERR(rdev->debugfs)) + rdev_dbg(rdev, "Failed to create debugfs directory\n"); debugfs_create_u32("use_count", 0444, rdev->debugfs, &rdev->use_count); @@ -6179,7 +6175,7 @@ static int __init regulator_init(void) debugfs_root = debugfs_create_dir("regulator", NULL); if (IS_ERR(debugfs_root)) - pr_warn("regulator: Failed to create debugfs directory\n"); + pr_debug("regulator: Failed to create debugfs directory\n"); #ifdef CONFIG_DEBUG_FS debugfs_create_file("supply_map", 0444, debugfs_root, NULL, |