]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: dac: ad7293: use dev_err_probe()
authorAntoniu Miclaus <antoniu.miclaus@analog.com>
Fri, 27 Feb 2026 14:01:39 +0000 (16:01 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 28 Feb 2026 11:35:24 +0000 (11:35 +0000)
Use dev_err_probe() consistently in the probe path to simplify error
handling and ensure deferred probes are logged correctly.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/dac/ad7293.c

index c86c54d53df1c706ca40d855c70547ed29893867..df6f126abf05cefb9b14d29651b97815bf35d0ae 100644 (file)
@@ -806,7 +806,7 @@ static int ad7293_init(struct ad7293_state *st)
 {
        int ret;
        u16 chip_id;
-       struct spi_device *spi = st->spi;
+       struct device *dev = &st->spi->dev;
 
        ret = ad7293_properties_parse(st);
        if (ret)
@@ -821,10 +821,8 @@ static int ad7293_init(struct ad7293_state *st)
        if (ret)
                return ret;
 
-       if (chip_id != AD7293_CHIP_ID) {
-               dev_err(&spi->dev, "Invalid Chip ID.\n");
-               return -EINVAL;
-       }
+       if (chip_id != AD7293_CHIP_ID)
+               return dev_err_probe(dev, -EINVAL, "Invalid Chip ID.\n");
 
        if (!st->vrefin_en)
                return __ad7293_spi_update_bits(st, AD7293_REG_GENERAL,