Linux-IIO Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] iio: adc: ad7780: Fix a resource handling path in 'ad7780_probe()'
@ 2020-05-17  9:59 Christophe JAILLET
  2020-05-18  2:21 ` Renato Lui Geh
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2020-05-17  9:59 UTC (permalink / raw)
  To: Michael.Hennerich, renatogeh, lars, jic23, knaack.h, pmeerw,
	giuliano.belinassi
  Cc: linux-iio, linux-kernel, kernel-janitors, 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")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/iio/adc/ad7780.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ad7780.c b/drivers/iio/adc/ad7780.c
index f47606ebbbbe..b33fe6c3907e 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))
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] iio: adc: ad7780: Fix a resource handling path in 'ad7780_probe()'
  2020-05-17  9:59 [PATCH] iio: adc: ad7780: Fix a resource handling path in 'ad7780_probe()' Christophe JAILLET
@ 2020-05-18  2:21 ` Renato Lui Geh
  0 siblings, 0 replies; 2+ messages in thread
From: Renato Lui Geh @ 2020-05-18  2:21 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Michael.Hennerich, renatogeh, lars, jic23, knaack.h, pmeerw,
	giuliano.belinassi, linux-iio, linux-kernel, kernel-janitors

Acked-by: Renato Lui Geh <renatogeh@gmail.com>

On 05/17, Christophe JAILLET wrote:
>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 <christophe.jaillet@wanadoo.fr>
>---
> drivers/iio/adc/ad7780.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/iio/adc/ad7780.c b/drivers/iio/adc/ad7780.c
>index f47606ebbbbe..b33fe6c3907e 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))
>-- 
>2.25.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-17  9:59 [PATCH] iio: adc: ad7780: Fix a resource handling path in 'ad7780_probe()' Christophe JAILLET
2020-05-18  2:21 ` Renato Lui Geh

Linux-IIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-iio/0 linux-iio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-iio linux-iio/ https://lore.kernel.org/linux-iio \
		linux-iio@vger.kernel.org
	public-inbox-index linux-iio

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-iio


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git