The power_supply_get_battery_info() fails if device-chemistry property
is missing in a device-tree because error variable is propagated to the
final return of the function, fix it.
Fixes: 4eef766b7d4d ("power: supply: core: Parse battery chemistry/technology")
Signed-off-by: Dmitry Osipenko <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
* Documentation/power/power_supply_class.rst.
*/
- err = of_property_read_string(battery_np, "device-chemistry", &value);
- if (!err) {
+ if (!of_property_read_string(battery_np, "device-chemistry", &value)) {
if (!strcmp("nickel-cadmium", value))
info->technology = POWER_SUPPLY_TECHNOLOGY_NiCd;
else if (!strcmp("nickel-metal-hydride", value))