From: phucduc.bui@gmail.com
To: Sebastian Reichel <sre@kernel.org>, Linus Walleij <linusw@kernel.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
bui duc phuc <phucduc.bui@gmail.com>
Subject: [PATCH] power: supply: generic-adc-battery: Propagate charged GPIO errors
Date: Fri, 9 Oct 2026 18:24:29 +0700 [thread overview]
Message-ID: <20261009112429.33318-1-phucduc.bui@gmail.com> (raw)
From: bui duc phuc <phucduc.bui@gmail.com>
devm_gpiod_get_optional() may return an error pointer such as
-EPROBE_DEFER, but gab_probe() only checks for NULL. The error
pointer is then passed to gpiod_to_irq() and the original error,
including -EPROBE_DEFER, is lost.
Check the return value and propagate errors from the charged GPIO lookup.
Fixes: b0327ffb133f ("power: supply: generic-adc-battery: Use GPIO descriptors")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
drivers/power/supply/generic-adc-battery.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/power/supply/generic-adc-battery.c b/drivers/power/supply/generic-adc-battery.c
index 185f55d2fd70..f3ca3ebb2533 100644
--- a/drivers/power/supply/generic-adc-battery.c
+++ b/drivers/power/supply/generic-adc-battery.c
@@ -238,6 +238,9 @@ static int gab_probe(struct platform_device *pdev)
return dev_err_probe(&pdev->dev, ret, "Failed to register delayed work\n");
adc_bat->charge_finished = devm_gpiod_get_optional(&pdev->dev, "charged", GPIOD_IN);
+ if (IS_ERR(adc_bat->charge_finished))
+ return dev_err_probe(&pdev->dev, PTR_ERR(adc_bat->charge_finished),
+ "failed to get charged GPIO\n");
if (adc_bat->charge_finished) {
int irq;
--
2.43.0
next reply other threads:[~2026-10-09 11:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 11:24 phucduc.bui [this message]
2026-10-09 12:20 ` [PATCH] power: supply: generic-adc-battery: Propagate charged GPIO errors Linus Walleij
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=20261009112429.33318-1-phucduc.bui@gmail.com \
--to=phucduc.bui@gmail.com \
--cc=linusw@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=sre@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.