* [PATCH 1/2] iio: sca3000: Fix an error handling path in 'sca3000_probe()'
@ 2018-04-02 16:59 Christophe JAILLET
2018-04-08 16:32 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2018-04-02 16:59 UTC (permalink / raw)
To: jic23, knaack.h, lars, pmeerw, nfarnesi4
Cc: linux-iio, linux-kernel, kernel-janitors, Christophe JAILLET
In case of error, we must undo the previous 'sca3000_configure_ring()' call
in order to free some memory.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/iio/accel/sca3000.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c
index f33dadf7b262..dae4c594c170 100644
--- a/drivers/iio/accel/sca3000.c
+++ b/drivers/iio/accel/sca3000.c
@@ -1496,7 +1496,7 @@ static int sca3000_probe(struct spi_device *spi)
"sca3000",
indio_dev);
if (ret)
- return ret;
+ goto error_unconfigure_ring;
}
indio_dev->setup_ops = &sca3000_ring_setup_ops;
ret = sca3000_clean_setup(st);
@@ -1513,6 +1513,9 @@ static int sca3000_probe(struct spi_device *spi)
if (spi->irq)
free_irq(spi->irq, indio_dev);
+error_unconfigure_ring:
+ sca3000_unconfigure_ring(indio_dev);
+
return ret;
}
--
2.14.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] iio: sca3000: Fix an error handling path in 'sca3000_probe()'
2018-04-02 16:59 [PATCH 1/2] iio: sca3000: Fix an error handling path in 'sca3000_probe()' Christophe JAILLET
@ 2018-04-08 16:32 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2018-04-08 16:32 UTC (permalink / raw)
To: Christophe JAILLET
Cc: knaack.h, lars, pmeerw, nfarnesi4, linux-iio, linux-kernel,
kernel-janitors
On Mon, 2 Apr 2018 18:59:42 +0200
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> In case of error, we must undo the previous 'sca3000_configure_ring()' call
> in order to free some memory.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Perhaps we can simplify this by using devm_iio_kfifo_allocate in
the ring configure function?
> ---
> drivers/iio/accel/sca3000.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c
> index f33dadf7b262..dae4c594c170 100644
> --- a/drivers/iio/accel/sca3000.c
> +++ b/drivers/iio/accel/sca3000.c
> @@ -1496,7 +1496,7 @@ static int sca3000_probe(struct spi_device *spi)
> "sca3000",
> indio_dev);
> if (ret)
> - return ret;
> + goto error_unconfigure_ring;
> }
> indio_dev->setup_ops = &sca3000_ring_setup_ops;
> ret = sca3000_clean_setup(st);
> @@ -1513,6 +1513,9 @@ static int sca3000_probe(struct spi_device *spi)
> if (spi->irq)
> free_irq(spi->irq, indio_dev);
>
> +error_unconfigure_ring:
> + sca3000_unconfigure_ring(indio_dev);
> +
> return ret;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-08 16:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-02 16:59 [PATCH 1/2] iio: sca3000: Fix an error handling path in 'sca3000_probe()' Christophe JAILLET
2018-04-08 16:32 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).