From: Andreas Kemnade <andreas@kemnade.info>
To: kr494167@gmail.com
Cc: broonie@kernel.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] regulator: tps65185: handle gpiod_get_value_cansleep() error returns
Date: Tue, 28 Jul 2026 20:04:01 +0200 [thread overview]
Message-ID: <amjvEb3dAz8-s3mX@akepd> (raw)
In-Reply-To: <20260724125858.75635-1-kr494167@gmail.com>
On Fri, Jul 24, 2026 at 06:28:57PM +0530, kr494167@gmail.com wrote:
> From: Surendra Singh Chouhan <kr494167@gmail.com>
>
> tps65185_vposneg_enable() evaluated:
> if (gpiod_get_value_cansleep(data->pgood_gpio) != 1)
> return -ETIMEDOUT;
>
> gpiod_get_value_cansleep() returns 1 if active, 0 if inactive, and a
> negative error code (e.g. -EIO or -EINVAL) on failure. Evaluating != 1
> treats a negative error code as non-equal, swallowing GPIO read errors and
> masking them as -ETIMEDOUT.
>
> Fix this by capturing the return value of gpiod_get_value_cansleep(). If
> it returns a negative error code, propagate that error immediately; if
> it returns 0 (inactive), return -ETIMEDOUT.
>
> Fixes: b0fc1e770194 ("regulator: Add TPS65185 driver")
> Signed-off-by: Surendra Singh Chouhan <kr494167@gmail.com>
Reviewed-by: Andreas Kemnade <andreas@kemnade.info>
prev parent reply other threads:[~2026-07-29 6:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 12:58 [PATCH] regulator: tps65185: handle gpiod_get_value_cansleep() error returns kr494167
2026-07-28 18:04 ` Andreas Kemnade [this message]
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=amjvEb3dAz8-s3mX@akepd \
--to=andreas@kemnade.info \
--cc=broonie@kernel.org \
--cc=kr494167@gmail.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@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