Re: [jic23-iio:testing 107/107] drivers/iio/adc/ti-ads1298.c:653:29: warning: variable 'ret' is uninitialized when used here

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> >> drivers/iio/adc/ti-ads1298.c:653:29: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]  
>      653 |                 return dev_err_probe(dev, ret, "Cannot get reset GPIO\n");
>          |                                           ^~~
>    drivers/iio/adc/ti-ads1298.c:642:9: note: initialize the variable 'ret' to silence this warning
>      642 |         int ret;
>          |                ^
>          |                 = 0
>    7 warnings generated.
> 

This is the only one that matters I think,

> 
> vim +/ret +653 drivers/iio/adc/ti-ads1298.c
> 
>    635	
>    636	static int ads1298_probe(struct spi_device *spi)
>    637	{
>    638		struct ads1298_private *priv;
>    639		struct iio_dev *indio_dev;
>    640		struct device *dev = &spi->dev;
>    641		struct gpio_desc *reset_gpio;
>    642		int ret;
>    643	
>    644		indio_dev = devm_iio_device_alloc(dev, sizeof(*priv));
>    645		if (!indio_dev)
>    646			return -ENOMEM;
>    647	
>    648		priv = iio_priv(indio_dev);
>    649	
>    650		/* Reset to be asserted before enabling clock and power */
>    651		reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
>    652		if (IS_ERR(reset_gpio))
>  > 653			return dev_err_probe(dev, ret, "Cannot get reset GPIO\n");  
Should be PTR_ERR(reset_gpio)

I'll fix it up when I'm on the right machine.


>    654	
>    655		/* VREF can be supplied externally, otherwise use internal reference */
>    656		priv->reg_vref = devm_regulator_get_optional(dev, "vref");
>    657		if (IS_ERR(priv->reg_vref)) {
>    658			if (PTR_ERR(priv->reg_vref) != -ENODEV)
>    659				return dev_err_probe(dev, PTR_ERR(priv->reg_avdd),
>    660						     "Failed to get vref regulator\n");
>    661	
>    662			priv->reg_vref = NULL;
>    663		} else {
>    664			ret = regulator_enable(priv->reg_vref);
>    665			if (ret)
>    666				return ret;
>    667	
>    668			ret = devm_add_action_or_reset(dev, ads1298_reg_disable, priv->reg_vref);
>    669			if (ret)
>    670				return ret;
>    671		}

Thanks as ever is due to the 0-day team! Should have gotten this in my local tests, but
maybe I wasn't paying enough attention to the results :(


Jonathan






[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux