]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
staging: iio: ad9834: simplify -ENOMEM return in probe
authorAngus Gardner <angusg778@gmail.com>
Mon, 4 May 2026 09:20:57 +0000 (19:20 +1000)
committerJonathan Cameron <jic23@kernel.org>
Sun, 31 May 2026 09:59:33 +0000 (10:59 +0100)
devm_iio_device_alloc() failure returns -ENOMEM via a local variable
unnecessarily. Return -ENOMEM directly instead.

Signed-off-by: Angus Gardner <angusg778@gmail.com>
Reviewed-by: Maxwell Doose <m32285159@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/staging/iio/frequency/ad9834.c

index 330db78fe76613c92f5ff1b41f165e1160f07354..e7aee3307061c73ec1eaece4fdfdf043c6951b73 100644 (file)
@@ -392,10 +392,8 @@ static int ad9834_probe(struct spi_device *spi)
                return dev_err_probe(&spi->dev, ret, "Failed to enable specified AVDD supply\n");
 
        indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
-       if (!indio_dev) {
-               ret = -ENOMEM;
-               return ret;
-       }
+       if (!indio_dev)
+               return -ENOMEM;
        st = iio_priv(indio_dev);
        mutex_init(&st->lock);
        st->mclk = devm_clk_get_enabled(&spi->dev, NULL);