Re: [PATCH v5 3/3] drivers: iio: adc: add support for ad777x family

From: Jonathan Cameron
Date: Sat Sep 14 2024 - 12:48:34 EST


skip "nr_"
> | ~~~~~~~~~~~ ^ ~~~
> >> drivers/iio/adc/ad7779.c:748:35: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
> 748 | return dev_err_probe(&spi->dev, ret,
> | ^~~
> drivers/iio/adc/ad7779.c:735:9: note: initialize the variable 'ret' to silence this warning
> 735 | int ret;
> | ^
> | = 0
Definitely don't do that!

just replace ret with -EINVAL

Jonathan

> 8 warnings generated.
>
>
> vim +/ret +748 drivers/iio/adc/ad7779.c
>
> 729
> 730 static int ad7779_probe(struct spi_device *spi)
> 731 {
> 732 struct iio_dev *indio_dev;
> 733 struct ad7779_state *st;
> 734 struct gpio_desc *reset_gpio, *start_gpio;
> 735 int ret;
> 736
> 737 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
> 738 if (!indio_dev)
> 739 return -ENOMEM;
> 740
> 741 st = iio_priv(indio_dev);
> 742
> 743 st->mclk = devm_clk_get_enabled(&spi->dev, "mclk");
> 744 if (IS_ERR(st->mclk))
> 745 return PTR_ERR(st->mclk);
> 746
> 747 if (!spi->irq)
> > 748 return dev_err_probe(&spi->dev, ret,
> 749 "DRDY irq not present\n");
> 750