@@ -40,11 +40,11 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp,
struct dentry *pdentry)
{
struct dentry *d;
- int i = 0;
+ int i = -1;
char *name;
/* Always create at least supply-0 directory */
- do {
+ while (++i < opp_table->regulator_count) {
name = kasprintf(GFP_KERNEL, "supply-%d", i);
/* Create per-opp directory */
@@ -70,7 +70,7 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp,
if (!debugfs_create_ulong("u_amp", S_IRUGO, d,
&opp->supplies[i].u_amp))
return false;
- } while (++i < opp_table->regulator_count);
+ }
return true;
}
We create "supply-0" debugfs directory even if the device doesn't do voltage scaling. That looks confusing, as if the regulator is found but we never managed to get voltage levels for it. Avoid creating such a directory unnecessarily. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- drivers/base/power/opp/debugfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.13.0.303.g4ebf3021692d