[PATCH 4/4] iio: frequency: ad9523: use dev_err_probe

Antoniu Miclaus posted 4 patches 1 month ago
There is a newer version of this series
[PATCH 4/4] iio: frequency: ad9523: use dev_err_probe
Posted by Antoniu Miclaus 1 month 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/frequency/ad9523.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c
index 6d15ec648280..f29a45837565 100644
--- a/drivers/iio/frequency/ad9523.c
+++ b/drivers/iio/frequency/ad9523.c
@@ -954,10 +954,8 @@ static int ad9523_probe(struct spi_device *spi)
 	struct ad9523_state *st;
 	int ret;
 
-	if (!pdata) {
-		dev_err(dev, "no platform data?\n");
-		return -EINVAL;
-	}
+	if (!pdata)
+		return dev_err_probe(dev, -EINVAL, "no platform data?\n");
 
 	indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
 	if (indio_dev == NULL)
-- 
2.43.0
Re: [PATCH 4/4] iio: frequency: ad9523: use dev_err_probe
Posted by Andy Shevchenko 1 month ago
On Fri, Mar 06, 2026 at 12:24:48PM +0200, 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.

...

> -	if (!pdata) {
> -		dev_err(dev, "no platform data?\n");
> -		return -EINVAL;
> -	}
> +	if (!pdata)
> +		return dev_err_probe(dev, -EINVAL, "no platform data?\n");

Platform data?! Maybe we can get rid of it entirely?

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH 4/4] iio: frequency: ad9523: use dev_err_probe
Posted by Jonathan Cameron 1 month ago
On Fri, 6 Mar 2026 14:24:25 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Fri, Mar 06, 2026 at 12:24:48PM +0200, 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.  
> 
> ...
> 
> > -	if (!pdata) {
> > -		dev_err(dev, "no platform data?\n");
> > -		return -EINVAL;
> > -	}
> > +	if (!pdata)
> > +		return dev_err_probe(dev, -EINVAL, "no platform data?\n");  
> 
> Platform data?! Maybe we can get rid of it entirely?

Good thing to do, but big job. There is no DT binding for this and
the platform data is very complex.  I checked though and the part is
still recommended for new designs so if Analog wants to support it going
forward that work needs doing.

Jonathan

>