public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Antoniu Miclaus <antoniu.miclaus@analog.com>
Cc: "Jorge Marques" <jorge.marques@analog.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Marcelo Schmitt" <marcelo.schmitt1@gmail.com>,
	"Renato Lui Geh" <renatogeh@gmail.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 05/13] iio: adc: ad7793: use dev_err_probe
Date: Sun, 12 Apr 2026 19:58:45 +0100	[thread overview]
Message-ID: <20260412195845.29495023@jic23-huawei> (raw)
In-Reply-To: <20260330111856.121589-6-antoniu.miclaus@analog.com>

On Mon, 30 Mar 2026 14:18:48 +0300
Antoniu Miclaus <antoniu.miclaus@analog.com> 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>
> ---
>  drivers/iio/adc/ad7793.c | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c
> index 21c667e37b31..624530cce938 100644
> --- a/drivers/iio/adc/ad7793.c
> +++ b/drivers/iio/adc/ad7793.c
> @@ -278,8 +278,8 @@ static int ad7793_setup(struct iio_dev *indio_dev,
>  	id &= AD7793_ID_MASK;
>  
>  	if (id != st->chip_info->id) {
> -		ret = -ENODEV;
> -		dev_err(&st->sd.spi->dev, "device ID query failed\n");
> +		ret = dev_err_probe(&st->sd.spi->dev, -ENODEV,

There are quite a few instances of this dereference nest.
Unless other things come up in this set I don't mind it being dealt
with separately but to me it seems like a helper to make this
		ret = dev_err_probe(adi_sigma_delta_get_dev(&st->sd), -ENODEV,
might be nice?  Longer line but avoids diving into the implementation details
in a driver that shouldn't really be doing that.


> +				    "device ID query failed\n");
>  		goto out;
>  	}
>  
> @@ -338,8 +338,7 @@ static int ad7793_setup(struct iio_dev *indio_dev,
>  
>  	return 0;
>  out:
> -	dev_err(&st->sd.spi->dev, "setup failed\n");
> -	return ret;
> +	return dev_err_probe(&st->sd.spi->dev, ret, "setup failed\n");
>  }
>  
>  static const u16 ad7793_sample_freq_avail[16] = {0, 470, 242, 123, 62, 50, 39,
> @@ -780,15 +779,11 @@ static int ad7793_probe(struct spi_device *spi)
>  	struct iio_dev *indio_dev;
>  	int ret, vref_mv = 0;
>  
> -	if (!pdata) {
> -		dev_err(&spi->dev, "no platform data?\n");
> -		return -ENODEV;
> -	}
> +	if (!pdata)
> +		return dev_err_probe(dev, -ENODEV, "no platform data?\n");
>  
> -	if (!spi->irq) {
> -		dev_err(&spi->dev, "no IRQ?\n");
> -		return -ENODEV;
> -	}
> +	if (!spi->irq)
> +		return dev_err_probe(dev, -ENODEV, "no IRQ?\n");
>  
>  	indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
>  	if (indio_dev == NULL)


  reply	other threads:[~2026-04-12 18:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-30 11:18 [PATCH 00/13] iio: adc: use dev_err_probe in probe paths Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 01/13] iio: adc: ad7949: use dev_err_probe Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 02/13] iio: adc: ad7780: add dev variable Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 03/13] iio: adc: ad7780: use dev_err_probe Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 04/13] iio: adc: ad7793: add dev variable Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 05/13] iio: adc: ad7793: use dev_err_probe Antoniu Miclaus
2026-04-12 18:58   ` Jonathan Cameron [this message]
2026-03-30 11:18 ` [PATCH 06/13] iio: adc: ad7292: add dev variable Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 07/13] iio: adc: ad7292: use dev_err_probe Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 08/13] iio: adc: ad7791: add dev variable Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 09/13] iio: adc: ad7791: use dev_err_probe Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 10/13] iio: adc: ad7280a: " Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 11/13] iio: adc: ad7768-1: " Antoniu Miclaus
2026-03-30 11:18 ` [PATCH 12/13] iio: adc: ad9467: " Antoniu Miclaus
2026-03-30 12:02   ` Tomas Melin
2026-03-30 11:18 ` [PATCH 13/13] iio: adc: ad4062: " Antoniu Miclaus
2026-04-12 19:02 ` [PATCH 00/13] iio: adc: use dev_err_probe in probe paths Jonathan Cameron

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=20260412195845.29495023@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=antoniu.miclaus@analog.com \
    --cc=dlechner@baylibre.com \
    --cc=jorge.marques@analog.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.schmitt1@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=renatogeh@gmail.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