summaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorBaolin Wang <baolin.wang@linaro.org>2018-11-16 19:01:11 +0800
committerSebastian Reichel <sebastian.reichel@collabora.com>2018-12-05 21:25:44 +0100
commita53a68cee88a4d892bdfcc793a661ced81cd1f56 (patch)
tree289d1a9d9a922f1982c04d26a4e0a14b42338adf /drivers/power
parentf25a646fbe2051527ad9721853e892d13a99199e (diff)
downloadlinux-a53a68cee88a4d892bdfcc793a661ced81cd1f56.tar.gz
linux-a53a68cee88a4d892bdfcc793a661ced81cd1f56.tar.bz2
linux-a53a68cee88a4d892bdfcc793a661ced81cd1f56.zip
power: supply: charger-manager: Make code more readable
Make code more readable. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/charger-manager.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c
index a52bc779e3d1..dc0c9a6c7d21 100644
--- a/drivers/power/supply/charger-manager.c
+++ b/drivers/power/supply/charger-manager.c
@@ -1520,19 +1520,19 @@ static struct charger_desc *of_cm_parse_desc(struct device *dev)
/* chargers */
of_property_read_u32(np, "cm-num-chargers", &num_chgs);
if (num_chgs) {
+ int i;
+
/* Allocate empty bin at the tail of array */
desc->psy_charger_stat = devm_kcalloc(dev,
num_chgs + 1,
sizeof(char *),
GFP_KERNEL);
- if (desc->psy_charger_stat) {
- int i;
- for (i = 0; i < num_chgs; i++)
- of_property_read_string_index(np, "cm-chargers",
- i, &desc->psy_charger_stat[i]);
- } else {
+ if (!desc->psy_charger_stat)
return ERR_PTR(-ENOMEM);
- }
+
+ for (i = 0; i < num_chgs; i++)
+ of_property_read_string_index(np, "cm-chargers",
+ i, &desc->psy_charger_stat[i]);
}
of_property_read_string(np, "cm-fuel-gauge", &desc->psy_fuel_gauge);