[PATCH] power: supply: max17042_battery: Fix vmin assigned instead of vmax in DT parsing

Xueqin Luo posted 1 patch 3 weeks, 4 days ago
drivers/power/supply/max17042_battery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] power: supply: max17042_battery: Fix vmin assigned instead of vmax in DT parsing
Posted by Xueqin Luo 3 weeks, 4 days ago
The else branch of the "maxim,over-volt" property check assigns the
parsed value to chip->vmin instead of chip->vmax, so chip->vmin is
overwritten and chip->vmax never gets the DT value.

Fixes: 6a3b47a5a5fc ("power: supply: Match DT value types")
Signed-off-by: Xueqin Luo <luoxueqin@kylinos.cn>
---
 drivers/power/supply/max17042_battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c
index cbf3ac9c3e14..505a68c26463 100644
--- a/drivers/power/supply/max17042_battery.c
+++ b/drivers/power/supply/max17042_battery.c
@@ -1233,7 +1233,7 @@ static int max17042_parse_dt(struct max17042_chip *chip)
 	if (of_property_read_u32(np, "maxim,over-volt", &prop))
 		chip->vmax = INT_MAX;
 	else
-		chip->vmin = prop;
+		chip->vmax = prop;
 
 	return 0;
 }
-- 
2.43.0
Re: [PATCH] power: supply: max17042_battery: Fix vmin assigned instead of vmax in DT parsing
Posted by Sebastian Reichel 2 weeks, 2 days ago
On Tue, 01 Sep 2026 13:36:52 +0800, Xueqin Luo wrote:
> The else branch of the "maxim,over-volt" property check assigns the
> parsed value to chip->vmin instead of chip->vmax, so chip->vmin is
> overwritten and chip->vmax never gets the DT value.

Applied, thanks!

[1/1] power: supply: max17042_battery: Fix vmin assigned instead of vmax in DT parsing
      commit: f444a42dce5caf5856b5289c48e0d48e531649d3

Best regards,
-- 
Sebastian Reichel <sebastian.reichel@collabora.com>
Re: [PATCH] power: supply: max17042_battery: Fix vmin assigned instead of vmax in DT parsing
Posted by Krzysztof Kozlowski 3 weeks, 4 days ago
On 01/09/2026 07:36, Xueqin Luo wrote:
> The else branch of the "maxim,over-volt" property check assigns the
> parsed value to chip->vmin instead of chip->vmax, so chip->vmin is
> overwritten and chip->vmax never gets the DT value.
> 
> Fixes: 6a3b47a5a5fc ("power: supply: Match DT value types")
> Signed-off-by: Xueqin Luo <luoxueqin@kylinos.cn>
> ---
>  drivers/power/supply/max17042_battery.c | 2 +-


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Best regards,
Krzysztof