[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251008133648.559286-1-i.abramov@mt-integration.ru>
Date: Wed, 8 Oct 2025 16:36:47 +0300
From: Ivan Abramov <i.abramov@...integration.ru>
To: Iskren Chernev <me@...ren.info>
CC: Ivan Abramov <i.abramov@...integration.ru>, Krzysztof Kozlowski
<krzk@...nel.org>, Marek Szyprowski <m.szyprowski@...sung.com>, Matheus
Castello <matheus@...tello.eng.br>, Sebastian Reichel <sre@...nel.org>,
Svyatoslav Ryhel <clamor95@...il.com>, <linux-pm@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <lvc-project@...uxtesting.org>
Subject: [PATCH 1/1] power: supply: max17040: Check iio_read_channel_processed() return code
Since iio_read_channel_processed() may fail, return its exit code on error.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 814755c48f8b ("power: max17040: get thermal data from adc if available")
Signed-off-by: Ivan Abramov <i.abramov@...integration.ru>
---
drivers/power/supply/max17040_battery.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c
index c1640bc6accd..48453508688a 100644
--- a/drivers/power/supply/max17040_battery.c
+++ b/drivers/power/supply/max17040_battery.c
@@ -388,6 +388,7 @@ static int max17040_get_property(struct power_supply *psy,
union power_supply_propval *val)
{
struct max17040_chip *chip = power_supply_get_drvdata(psy);
+ int ret;
switch (psp) {
case POWER_SUPPLY_PROP_ONLINE:
@@ -410,7 +411,10 @@ static int max17040_get_property(struct power_supply *psy,
if (!chip->channel_temp)
return -ENODATA;
- iio_read_channel_processed(chip->channel_temp, &val->intval);
+ ret = iio_read_channel_processed(chip->channel_temp, &val->intval);
+ if (ret)
+ return ret;
+
val->intval /= 100; /* Convert from milli- to deci-degree */
break;
--
2.39.5
Powered by blists - more mailing lists