Commit b0536f98 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Jonathan Cameron

iio: adc: ad7780: Fix a resource handling path in 'ad7780_probe()'

If 'ad7780_init_gpios()' fails, we must not release some resources that
have not been allocated yet. Return directly instead.

Fixes: 5bb30e7d ("staging: iio: ad7780: move regulator to after GPIO init")
Fixes: 9085daa4 ("staging: iio: ad7780: add gain & filter gpio support")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: default avatarRenato Lui Geh <renatogeh@gmail.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 8db4afe1
......@@ -329,7 +329,7 @@ static int ad7780_probe(struct spi_device *spi)
ret = ad7780_init_gpios(&spi->dev, st);
if (ret)
goto error_cleanup_buffer_and_trigger;
return ret;
st->reg = devm_regulator_get(&spi->dev, "avdd");
if (IS_ERR(st->reg))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment