diff mbox series

iio: adc: at91-sama5d2_adc: fix an error code in at91_adc_allocate_trigger()

Message ID 5d728f9d-31d1-410d-a0b3-df6a63a2c8ba@kili.mountain (mailing list archive)
State Accepted
Headers show
Series iio: adc: at91-sama5d2_adc: fix an error code in at91_adc_allocate_trigger() | expand

Commit Message

Dan Carpenter March 29, 2023, 4:35 a.m. UTC
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(-)

Comments

Jonathan Cameron April 1, 2023, 2:50 p.m. UTC | #1
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);
diff mbox series

Patch

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