Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Ivan Abramov <i.abramov@mt-integration.ru>,
	Sebastian Reichel <sebastian.reichel@collabora.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10.y 3/4] power: supply: max17040: Check iio_read_channel_processed() return code
Date: Wed,  9 Sep 2026 07:58:12 -0400	[thread overview]
Message-ID: <20260909115813.2181976-3-sashal@kernel.org> (raw)
In-Reply-To: <20260909115813.2181976-1-sashal@kernel.org>

From: Ivan Abramov <i.abramov@mt-integration.ru>

[ Upstream commit 2c68ac48c52ad146523f32b01d70009622bf81aa ]

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@mt-integration.ru>
Link: https://patch.msgid.link/20251008133648.559286-1-i.abramov@mt-integration.ru
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

[Stable dependency adaptation]
The 5.10 driver has no IIO temperature channel or TEMP property, so omit
the temperature-read hunk and its unavailable supplier-status context.
Retain the local ret variable required by 659cc3d8d5ef ("power: supply:
max17040: propagate register read errors"), which uses it without adding
a declaration in max17040_get_property().

Initialize ret to -EINVAL and use it for the existing unsupported-property
return. This avoids an unused-variable warning before the target is
applied, while keeping successful callbacks returning zero even after
the target stores positive voltage or capacity values in ret. No driver
functions or new properties are added.

Stable-dep-of: 659cc3d8d5ef ("power: supply: max17040: propagate register read errors")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/power/supply/max17040_battery.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c
index 8b2f0726ef0c0..fad244a73c8ea 100644
--- a/drivers/power/supply/max17040_battery.c
+++ b/drivers/power/supply/max17040_battery.c
@@ -392,6 +392,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 = -EINVAL;
 
 	switch (psp) {
 	case POWER_SUPPLY_PROP_ONLINE:
@@ -407,7 +408,7 @@ static int max17040_get_property(struct power_supply *psy,
 		val->intval = chip->low_soc_alert;
 		break;
 	default:
-		return -EINVAL;
+		return ret;
 	}
 	return 0;
 }
-- 
2.53.0


  parent reply	other threads:[~2026-09-09 11:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03 14:39 FAILED: patch "[PATCH] power: supply: max17040: propagate register read errors" failed to apply to 5.10-stable tree gregkh
2026-09-09 11:58 ` [PATCH 5.10.y 1/4] power: supply: max17040: remove non-working POWER_SUPPLY_PROP_STATUS Sasha Levin
2026-09-09 11:58   ` [PATCH 5.10.y 2/4] power: supply: max17040: extend help/description Sasha Levin
2026-09-09 11:58   ` Sasha Levin [this message]
2026-09-09 11:58   ` [PATCH 5.10.y 4/4] power: supply: max17040: propagate register read errors Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260909115813.2181976-3-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=i.abramov@mt-integration.ru \
    --cc=sebastian.reichel@collabora.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox