Skip to content

Commit e4c7664

Browse files
author
Al Stone
committed
power: supply: Reset err after not finding static battery
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2071846 Tested: This is one of a series of patch sets to enable Arm SystemReady IR support in the kernel for NXP i.MX8 platforms. This set updates the power subsystem. This set has been tested via simple boot tests and the CI loop. commit 581045e Author: Yassine Oudjana <y.oudjana@protonmail.com> Date: Tue Mar 29 03:34:03 2022 +0000 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> (cherry picked from commit 581045e) Signed-off-by: Al Stone <ahs3@redhat.com>
1 parent 7f5cda0 commit e4c7664

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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)