power-supply: Use 'break' instead of 'continue' to end loop
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 4 Sep 2014 12:01:27 +0000 (17:31 +0530)
committerSebastian Reichel <sre@kernel.org>
Tue, 16 Sep 2014 09:01:30 +0000 (11:01 +0200)
In few routines, we need to end the do-while loop when no more "power-supplies"
are available. Currently we are doing 'continue' which will make the
'while(np)' conditional statement run again.

Skip this by doing a 'break' instead.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
drivers/power/power_supply_core.c

index 71d00ecca881eb5e8b10a370eaeaf58a0210c947..7657335ea7f99064a90da5d3112bac2d9b91ded3 100644 (file)
@@ -127,7 +127,7 @@ static int __power_supply_populate_supplied_from(struct device *dev,
        do {
                np = of_parse_phandle(psy->of_node, "power-supplies", i++);
                if (!np)
-                       continue;
+                       break;
 
                if (np == epsy->of_node) {
                        dev_info(psy->dev, "%s: Found supply : %s\n",
@@ -215,7 +215,7 @@ static int power_supply_check_supplies(struct power_supply *psy)
 
                np = of_parse_phandle(psy->of_node, "power-supplies", cnt++);
                if (!np)
-                       continue;
+                       break;
 
                ret = power_supply_find_supply_from_node(np);
                if (ret) {