All of lore.kernel.org
 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 6.6.y 1/2] power: supply: max17040: Check iio_read_channel_processed() return code
Date: Wed,  9 Sep 2026 07:28:21 -0400	[thread overview]
Message-ID: <20260909112822.1848327-1-sashal@kernel.org> (raw)
In-Reply-To: <2026090314-oncoming-condition-a40f@gregkh>

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]
Linux 6.6 does not contain the optional IIO temperature support introduced
by 814755c48f8b, so omit the temperature-read error-checking hunk and the
unavailable status/temperature context.

Retain the local ret declaration: target 659cc3d8d5ef uses it to propagate
voltage and capacity read errors without adding a declaration of its own.
Use ret for the existing -EINVAL default case so this dependency builds
without an unused-variable warning before the target is applied. Keep the
successful return as zero; the target stores positive readings in ret.

This is a prerequisite-only adaptation with unchanged driver behavior and
no added functions.

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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c
index ff42db6728991..28c66c1fe6e43 100644
--- a/drivers/power/supply/max17040_battery.c
+++ b/drivers/power/supply/max17040_battery.c
@@ -386,6 +386,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:
@@ -401,7 +402,8 @@ static int max17040_get_property(struct power_supply *psy,
 		val->intval = chip->low_soc_alert;
 		break;
 	default:
-		return -EINVAL;
+		ret = -EINVAL;
+		return ret;
 	}
 	return 0;
 }
-- 
2.53.0


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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03 15:00 FAILED: patch "[PATCH] power: supply: max17040: propagate register read errors" failed to apply to 6.6-stable tree gregkh
2026-09-09 11:28 ` Sasha Levin [this message]
2026-09-09 11:28   ` [PATCH 6.6.y 2/2] 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=20260909112822.1848327-1-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.