Skip to contentSkip to conversation

iio: adc: ad4170-4: Use ERR_PTR() in ad4170_read_sample()

PATCH New Salah Triki 1 participant 1 message Aug 7, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: adc: ad4170-4: Use ERR_PTR() in ad4170_read_sample()

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.

---
 drivers/iio/adc/ad4170-4.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ad4170-4.c +2 -2
index 6cd84d6fb08b..6296b5dc930b 100644
@@ -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;
 	}
Signature · 1 line
2.43.0