Skip to content

Commit 581045e

Browse files
Tooniissre
authored andcommitted
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: c8aee3f ("power: supply: Static data for Samsung batteries") Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent 5c7d28c commit 581045e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/power/supply/power_supply_core.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,12 @@ int power_supply_get_battery_info(struct power_supply *psy,
604604
err = samsung_sdi_battery_get_info(&psy->dev, value, &info);
605605
if (!err)
606606
goto out_ret_pointer;
607+
else if (err == -ENODEV)
608+
/*
609+
* Device does not have a static battery.
610+
* Proceed to look for a simple battery.
611+
*/
612+
err = 0;
607613

608614
if (strcmp("simple-battery", value)) {
609615
err = -ENODEV;

0 commit comments

Comments
 (0)