[PATCH] power: supply: ds2780: Fix ds2780_get_capacity() returning raw value

From: Xueqin Luo

Date: Tue Sep 01 2026 - 03:39:21 EST


ds2780_get_capacity() returns the raw register value instead of 0 on
success. The capacity is already stored in *capacity, so the function
should return 0 to indicate success.

Fixes: 275ac74629c4 ("w1: add Maxim/Dallas DS2780 Stand-Alone Fuel Gauge IC support")
Signed-off-by: Xueqin Luo <luoxueqin@xxxxxxxxxx>
---
drivers/power/supply/ds2780_battery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/ds2780_battery.c b/drivers/power/supply/ds2780_battery.c
index 5b57bbba79d4..ef2446386c2a 100644
--- a/drivers/power/supply/ds2780_battery.c
+++ b/drivers/power/supply/ds2780_battery.c
@@ -304,7 +304,7 @@ static int ds2780_get_capacity(struct ds2780_device_info *dev_info,
return ret;

*capacity = raw;
- return raw;
+ return 0;
}

static int ds2780_get_status(struct ds2780_device_info *dev_info, int *status)
--
2.43.0