···15201520 /* chargers */15211521 of_property_read_u32(np, "cm-num-chargers", &num_chgs);15221522 if (num_chgs) {15231523+ int i;15241524+15231525 /* Allocate empty bin at the tail of array */15241526 desc->psy_charger_stat = devm_kcalloc(dev,15251527 num_chgs + 1,15261528 sizeof(char *),15271529 GFP_KERNEL);15281528- if (desc->psy_charger_stat) {15291529- int i;15301530- for (i = 0; i < num_chgs; i++)15311531- of_property_read_string_index(np, "cm-chargers",15321532- i, &desc->psy_charger_stat[i]);15331533- } else {15301530+ if (!desc->psy_charger_stat)15341531 return ERR_PTR(-ENOMEM);15351535- }15321532+15331533+ for (i = 0; i < num_chgs; i++)15341534+ of_property_read_string_index(np, "cm-chargers",15351535+ i, &desc->psy_charger_stat[i]);15361536 }1537153715381538 of_property_read_string(np, "cm-fuel-gauge", &desc->psy_fuel_gauge);