From: Christophe JAILLET Date: Sun, 17 May 2020 09:59:53 +0000 (+0200) Subject: iio: adc: ad7780: Fix a resource handling path in 'ad7780_probe()' X-Git-Tag: v5.15~3383^2~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b0536f9826a5ed3328d527b4fc1686867a9f3041;p=platform%2Fkernel%2Flinux-starfive.git 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: 5bb30e7daf00 ("staging: iio: ad7780: move regulator to after GPIO init") Fixes: 9085daa4abcc ("staging: iio: ad7780: add gain & filter gpio support") Signed-off-by: Christophe JAILLET Acked-by: Renato Lui Geh Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/adc/ad7780.c b/drivers/iio/adc/ad7780.c index f47606e..b33fe6c 100644 --- a/drivers/iio/adc/ad7780.c +++ b/drivers/iio/adc/ad7780.c @@ -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))