Commit 581045ed authored by Yassine Oudjana's avatar Yassine Oudjana Committed by Sebastian Reichel

power: supply: Reset err after not finding static battery

Otherwise power_supply_get_battery_info always returns -ENODEV
on devices that do not have a static battery, even when a simple
battery is found.

Fixes: c8aee3f4 ("power: supply: Static data for Samsung batteries")
Signed-off-by: default avatarYassine Oudjana <y.oudjana@protonmail.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent 5c7d28c6
......@@ -604,6 +604,12 @@ int power_supply_get_battery_info(struct power_supply *psy,
err = samsung_sdi_battery_get_info(&psy->dev, value, &info);
if (!err)
goto out_ret_pointer;
else if (err == -ENODEV)
/*
* Device does not have a static battery.
* Proceed to look for a simple battery.
*/
err = 0;
if (strcmp("simple-battery", value)) {
err = -ENODEV;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment