All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: adc: at91-sama5d2_adc: fix an error code in at91_adc_allocate_trigger()
@ 2023-03-29  4:35 Dan Carpenter
  2023-04-01 14:50 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2023-03-29  4:35 UTC (permalink / raw)
  To: Eugen Hristev
  Cc: Jonathan Cameron, Lars-Peter Clausen, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Ludovic Desroches, linux-iio,
	kernel-janitors

The at91_adc_allocate_trigger() function is supposed to return error
pointers.  Returning a NULL will cause an Oops.

Fixes: 5e1a1da0f8c9 ("iio: adc: at91-sama5d2_adc: add hw trigger and buffer support")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
 drivers/iio/adc/at91-sama5d2_adc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index b5d0c9ee284c..2a9fdc5b7edf 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -1409,7 +1409,7 @@ static struct iio_trigger *at91_adc_allocate_trigger(struct iio_dev *indio,
 	trig = devm_iio_trigger_alloc(&indio->dev, "%s-dev%d-%s", indio->name,
 				iio_device_id(indio), trigger_name);
 	if (!trig)
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 
 	trig->dev.parent = indio->dev.parent;
 	iio_trigger_set_drvdata(trig, indio);
-- 
2.39.1


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

* Re: [PATCH] iio: adc: at91-sama5d2_adc: fix an error code in at91_adc_allocate_trigger()
  2023-03-29  4:35 [PATCH] iio: adc: at91-sama5d2_adc: fix an error code in at91_adc_allocate_trigger() Dan Carpenter
@ 2023-04-01 14:50 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2023-04-01 14:50 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Eugen Hristev, Lars-Peter Clausen, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Ludovic Desroches, linux-iio,
	kernel-janitors

On Wed, 29 Mar 2023 07:35:32 +0300
Dan Carpenter <error27@gmail.com> wrote:

> The at91_adc_allocate_trigger() function is supposed to return error
> pointers.  Returning a NULL will cause an Oops.
> 
> Fixes: 5e1a1da0f8c9 ("iio: adc: at91-sama5d2_adc: add hw trigger and buffer support")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Seems obvious enough I've queued this up in the iio-fixes branch of iio.git.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/at91-sama5d2_adc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
> index b5d0c9ee284c..2a9fdc5b7edf 100644
> --- a/drivers/iio/adc/at91-sama5d2_adc.c
> +++ b/drivers/iio/adc/at91-sama5d2_adc.c
> @@ -1409,7 +1409,7 @@ static struct iio_trigger *at91_adc_allocate_trigger(struct iio_dev *indio,
>  	trig = devm_iio_trigger_alloc(&indio->dev, "%s-dev%d-%s", indio->name,
>  				iio_device_id(indio), trigger_name);
>  	if (!trig)
> -		return NULL;
> +		return ERR_PTR(-ENOMEM);
>  
>  	trig->dev.parent = indio->dev.parent;
>  	iio_trigger_set_drvdata(trig, indio);


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

end of thread, other threads:[~2023-04-01 14:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29  4:35 [PATCH] iio: adc: at91-sama5d2_adc: fix an error code in at91_adc_allocate_trigger() Dan Carpenter
2023-04-01 14:50 ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.