From: André Draszik Date: Mon, 2 Mar 2026 13:32:06 +0000 (+0000) Subject: power: supply: max17042: time to empty is meaningless when charging X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c5a6dc85d739c41f5240fd149f42f26f0665aab;p=thirdparty%2Fkernel%2Flinux.git power: supply: max17042: time to empty is meaningless when charging When charging, the fuel gauge reports U16_MAX as time to empty. Ignoring this special case (as this driver currently does), causes the remaining time to be reported as ~102hours, which is incorrect. Update the code to not return anything in this case. Reviewed-by: Peter Griffin Signed-off-by: André Draszik Link: https://patch.msgid.link/20260302-max77759-fg-v3-7-3c5f01dbda23@linaro.org Signed-off-by: Sebastian Reichel --- diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c index 39091fb317119..0a6960bbf3a29 100644 --- a/drivers/power/supply/max17042_battery.c +++ b/drivers/power/supply/max17042_battery.c @@ -430,6 +430,10 @@ static int max17042_get_property(struct power_supply *psy, if (ret < 0) return ret; + /* when charging, the value is not meaningful */ + if (data == U16_MAX) + return -ENODATA; + val->intval = data * 5625 / 1000; break; default: