Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: adc: ad4170-4: Use ERR_PTR() in ad4170_read_sample()
@ 2025-08-07  7:50 Salah Triki
  0 siblings, 0 replies; only message in thread
From: Salah Triki @ 2025-08-07  7:50 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Marcelo Schmitt,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	linux-iio, linux-kernel
  Cc: salah.triki

Use ERR_PTR(ret) with %pe in ad4170_read_sample() to properly display
symbolic error codes (e.g. -ENOMEM) instead of raw integers (e.g. -12),
improving readability and debug clarity.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 drivers/iio/adc/ad4170-4.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/ad4170-4.c b/drivers/iio/adc/ad4170-4.c
index 6cd84d6fb08b..6296b5dc930b 100644
--- a/drivers/iio/adc/ad4170-4.c
+++ b/drivers/iio/adc/ad4170-4.c
@@ -1253,11 +1253,11 @@ static int ad4170_read_sample(struct iio_dev *indio_dev,
 
 	ret = __ad4170_read_sample(indio_dev, chan, val);
 	if (ret) {
-		dev_err(dev, "failed to read sample: %d\n", ret);
+		dev_err(dev, "failed to read sample: %pe\n", ERR_PTR(ret));
 
 		ret2 = ad4170_set_channel_enable(st, chan->address, false);
 		if (ret2)
-			dev_err(dev, "failed to disable channel: %d\n", ret2);
+			dev_err(dev, "failed to disable channel: %pe\n", ERR_PTR(ret2));
 
 		return ret;
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-08-07  7:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-07  7:50 [PATCH] iio: adc: ad4170-4: Use ERR_PTR() in ad4170_read_sample() Salah Triki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox