From: Salah Triki <salah.triki@gmail.com>
To: Michael Hennerich <Michael.Hennerich@analog.com>,
Nuno Sa <nuno.sa@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Jonathan Cameron <jic23@kernel.org>,
David Lechner <dlechner@baylibre.com>,
Andy Shevchenko <andy@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: salah.triki@gmail.com
Subject: [PATCH] iio: adc: ad9467: Replace PTR_ERR_OR_ZERO() in ad9467_reset()
Date: Thu, 7 Aug 2025 02:39:23 +0100 [thread overview]
Message-ID: <aJQDyzoxLsF8nKYW@pc> (raw)
PTR_ERR_OR_ZERO() returns 0 if the argument is NULL, which can hide real
issues when the caller expects an ERR_PTR on failure. Use a ternary
expression instead to return the appropriate error code.
Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
drivers/iio/adc/ad9467.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ad9467.c b/drivers/iio/adc/ad9467.c
index f7a9f46ea0dc..70aee2666ff1 100644
--- a/drivers/iio/adc/ad9467.c
+++ b/drivers/iio/adc/ad9467.c
@@ -945,7 +945,7 @@ static int ad9467_reset(struct device *dev)
gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR_OR_NULL(gpio))
- return PTR_ERR_OR_ZERO(gpio);
+ return gpio ? PTR_ERR(gpio) : -ENODEV;
fsleep(1);
gpiod_set_value_cansleep(gpio, 0);
--
2.43.0
next reply other threads:[~2025-08-07 1:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-07 1:39 Salah Triki [this message]
2025-08-07 2:07 ` [PATCH] iio: adc: ad9467: Replace PTR_ERR_OR_ZERO() in ad9467_reset() David Lechner
2025-08-07 20:38 ` Andy Shevchenko
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=aJQDyzoxLsF8nKYW@pc \
--to=salah.triki@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
/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