Re: [PATCH 1/7] iio: frequency: adrf6780: use dev_err_probe in probe path
From: Jonathan Cameron
Date: Sun Feb 22 2026 - 11:59:12 EST
On Fri, 20 Feb 2026 15:56:54 +0200
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> On Fri, Feb 20, 2026 at 03:11:39PM +0200, Antoniu Miclaus wrote:
> > Replace dev_err() + return with dev_err_probe() in adrf6780_reset()
> > and adrf6780_init(), which are called during probe. This simplifies
> > error handling.
>
> ...
>
> > ret = __adrf6780_spi_update_bits(st, ADRF6780_REG_CONTROL,
> > ADRF6780_SOFT_RESET_MSK,
> > FIELD_PREP(ADRF6780_SOFT_RESET_MSK, 1));
> > - if (ret) {
> > - dev_err(&spi->dev, "ADRF6780 SPI software reset failed.\n");
> > - return ret;
> > - }
> > + if (ret)
> > + return dev_err_probe(&spi->dev, ret,
> > + "ADRF6780 SPI software reset failed.\n");
>
> Consider adding
>
> struct device *dev = &spi->dev;
spi itself isn't used so
struct device *dev = &st->spi->dev;
probably make sense here
Might be worth similar changes for probe() etc where there is a lot of &spi->dev
in use. At that point it would probably need to be a separate precursor patch to this one.
Thanks,
Jonathan
>
> at the top, so this line becomes
>
> return dev_err_probe(dev, ret, "ADRF6780 SPI software reset failed.\n");
>
> (while at it, I would dare to drop 'SPI' from the message as is easy to derive that
> the device in question is connected to SPI bus.)
>
> return dev_err_probe(dev, ret, "ADRF6780 software reset failed.\n");
>
> ...
>
> Ditto for the rest.
>