[PATCH 12/13] iio: adc: ad9467: use dev_err_probe

Antoniu Miclaus posted 13 patches 6 days, 21 hours ago
[PATCH 12/13] iio: adc: ad9467: use dev_err_probe
Posted by Antoniu Miclaus 6 days, 21 hours ago
Use dev_err_probe() instead of dev_err() in the probe path to ensure
proper handling of deferred probing and to simplify error handling.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
 drivers/iio/adc/ad9467.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/ad9467.c b/drivers/iio/adc/ad9467.c
index 0bf67437508f..0c377f9a7f25 100644
--- a/drivers/iio/adc/ad9467.c
+++ b/drivers/iio/adc/ad9467.c
@@ -1349,11 +1349,10 @@ static int ad9467_probe(struct spi_device *spi)
 		return ret;
 
 	id = ad9467_spi_read(st, AN877_ADC_REG_CHIP_ID);
-	if (id != st->info->id) {
-		dev_err(dev, "Mismatch CHIP_ID, got 0x%X, expected 0x%X\n",
-			id, st->info->id);
-		return -ENODEV;
-	}
+	if (id != st->info->id)
+		return dev_err_probe(dev, -ENODEV,
+				     "Mismatch CHIP_ID, got 0x%X, expected 0x%X\n",
+				     id, st->info->id);
 
 	if (st->info->num_scales > 1)
 		indio_dev->info = &ad9467_info;
-- 
2.43.0
Re: [PATCH 12/13] iio: adc: ad9467: use dev_err_probe
Posted by Tomas Melin 6 days, 21 hours ago
On 30/03/2026 14:18, Antoniu Miclaus wrote:
> Use dev_err_probe() instead of dev_err() in the probe path to ensure
> proper handling of deferred probing and to simplify error handling.
>
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>

Reviewed-by: Tomas Melin <tomas.melin@vaisala.com>

> ---
>   drivers/iio/adc/ad9467.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/adc/ad9467.c b/drivers/iio/adc/ad9467.c
> index 0bf67437508f..0c377f9a7f25 100644
> --- a/drivers/iio/adc/ad9467.c
> +++ b/drivers/iio/adc/ad9467.c
> @@ -1349,11 +1349,10 @@ static int ad9467_probe(struct spi_device *spi)
>   		return ret;
>   
>   	id = ad9467_spi_read(st, AN877_ADC_REG_CHIP_ID);
> -	if (id != st->info->id) {
> -		dev_err(dev, "Mismatch CHIP_ID, got 0x%X, expected 0x%X\n",
> -			id, st->info->id);
> -		return -ENODEV;
> -	}
> +	if (id != st->info->id)
> +		return dev_err_probe(dev, -ENODEV,
> +				     "Mismatch CHIP_ID, got 0x%X, expected 0x%X\n",
> +				     id, st->info->id);
>   
>   	if (st->info->num_scales > 1)
>   		indio_dev->info = &ad9467_info;