Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Baolin Wang and committed by
Sebastian Reichel
a53a68ce f25a646f

+7 -7
+7 -7
drivers/power/supply/charger-manager.c
··· 1520 1520 /* chargers */ 1521 1521 of_property_read_u32(np, "cm-num-chargers", &num_chgs); 1522 1522 if (num_chgs) { 1523 + int i; 1524 + 1523 1525 /* Allocate empty bin at the tail of array */ 1524 1526 desc->psy_charger_stat = devm_kcalloc(dev, 1525 1527 num_chgs + 1, 1526 1528 sizeof(char *), 1527 1529 GFP_KERNEL); 1528 - if (desc->psy_charger_stat) { 1529 - int i; 1530 - for (i = 0; i < num_chgs; i++) 1531 - of_property_read_string_index(np, "cm-chargers", 1532 - i, &desc->psy_charger_stat[i]); 1533 - } else { 1530 + if (!desc->psy_charger_stat) 1534 1531 return ERR_PTR(-ENOMEM); 1535 - } 1532 + 1533 + for (i = 0; i < num_chgs; i++) 1534 + of_property_read_string_index(np, "cm-chargers", 1535 + i, &desc->psy_charger_stat[i]); 1536 1536 } 1537 1537 1538 1538 of_property_read_string(np, "cm-fuel-gauge", &desc->psy_fuel_gauge);