Skip to content

Commit

Permalink
iio: adc: ad7780: Fix a resource handling path in 'ad7780_probe()'
Browse files Browse the repository at this point in the history
If 'ad7780_init_gpios()' fails, we must not release some resources that
have not been allocated yet. Return directly instead.

Fixes: 5bb30e7 ("staging: iio: ad7780: move regulator to after GPIO init")
Fixes: 9085daa ("staging: iio: ad7780: add gain & filter gpio support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Renato Lui Geh <renatogeh@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  • Loading branch information
tititiou36 authored and jic23 committed Jul 5, 2020
1 parent 8db4afe commit b0536f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/adc/ad7780.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit b0536f9

Please sign in to comment.