power-supply: Rearrange code to remove duplicate lines
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 4 Sep 2014 12:01:28 +0000 (17:31 +0530)
committerSebastian Reichel <sre@kernel.org>
Tue, 16 Sep 2014 09:01:31 +0000 (11:01 +0200)
of_node_put() was called twice in power_supply_check_supplies() whereas a single
call will also work. Rearrange code a bit to make that feasible.

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

index 7657335ea7f99064a90da5d3112bac2d9b91ded3..8a86cd138de8c91a7496064c068f33bd8b0f028e 100644 (file)
@@ -218,12 +218,12 @@ static int power_supply_check_supplies(struct power_supply *psy)
                        break;
 
                ret = power_supply_find_supply_from_node(np);
+               of_node_put(np);
+
                if (ret) {
                        dev_dbg(psy->dev, "Failed to find supply, defer!\n");
-                       of_node_put(np);
                        return -EPROBE_DEFER;
                }
-               of_node_put(np);
        } while (np);
 
        /* Missing valid "power-supplies" entries */