Skip to contentSkip to conversation

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

PATCH Applied Christophe JAILLET 3 participants 3 messages May 17, 2020 – Jul 5, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/iio/adc/ad7780.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ad7780.c +1 -1
index f47606ebbbbe..b33fe6c3907e 100644
@@ -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))
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 26 lines · Christophe JAILLET

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")

---
drivers/iio/adc/ad7780.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ad7780.c +1 -1
index f47606ebbbbe..b33fe6c3907e 100644
@@ -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))
Signature · 1 line
2.25.1
maintainer Applied
#2 lore raw
Quoted 9 lines · On Sun, 17 May 2020 23:21:29 -0300 Renato Lui Geh <[email protected]> wrote:
Quoted 6 lines · Christophe JAILLET

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")

Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan

Quoted 20 lines
Quoted 20 lines

---
drivers/iio/adc/ad7780.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ad7780.c +1 -1
index f47606ebbbbe..b33fe6c3907e 100644
@@ -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))
Signature · 1 line
2.25.1