Skip to content

Commit 95b78d5

Browse files
Junlin Yangsre
authored andcommitted
power: supply: charger-manager: fix incorrect health status
cm->emergency_stop will only be the value in the enumeration, and cannot be less than zero, it will get an exception value. So replace it with the corresponding value. Signed-off-by: Junlin Yang <yangjunlin@yulong.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent b7e15bd commit 95b78d5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/power/supply/charger-manager.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -723,9 +723,9 @@ static int charger_get_property(struct power_supply *psy,
723723
val->intval = cm->battery_status;
724724
break;
725725
case POWER_SUPPLY_PROP_HEALTH:
726-
if (cm->emergency_stop > 0)
726+
if (cm->emergency_stop == CM_BATT_OVERHEAT)
727727
val->intval = POWER_SUPPLY_HEALTH_OVERHEAT;
728-
else if (cm->emergency_stop < 0)
728+
else if (cm->emergency_stop == CM_BATT_COLD)
729729
val->intval = POWER_SUPPLY_HEALTH_COLD;
730730
else
731731
val->intval = POWER_SUPPLY_HEALTH_GOOD;

0 commit comments

Comments
 (0)