2022-02-24 06:46:21

by Jiasheng Jiang

[permalink] [raw]
Subject: [PATCH] iio: adc: Add check for devm_request_threaded_irq

As the potential failure of the devm_request_threaded_irq(),
it should be better to check the return value and return
error if fails.

Fixes: fa659a40b80b ("iio: adc: twl6030-gpadc: Use devm_* API family")
Signed-off-by: Jiasheng Jiang <[email protected]>
---
drivers/iio/adc/twl6030-gpadc.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c
index afdb59e0b526..d0223e39d59a 100644
--- a/drivers/iio/adc/twl6030-gpadc.c
+++ b/drivers/iio/adc/twl6030-gpadc.c
@@ -911,6 +911,8 @@ static int twl6030_gpadc_probe(struct platform_device *pdev)
ret = devm_request_threaded_irq(dev, irq, NULL,
twl6030_gpadc_irq_handler,
IRQF_ONESHOT, "twl6030_gpadc", indio_dev);
+ if (ret)
+ return ret;

ret = twl6030_gpadc_enable_irq(TWL6030_GPADC_RT_SW1_EOC_MASK);
if (ret < 0) {
--
2.25.1


2022-02-26 19:40:12

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH] iio: adc: Add check for devm_request_threaded_irq

On Thu, 24 Feb 2022 14:28:49 +0800
Jiasheng Jiang <[email protected]> wrote:

> As the potential failure of the devm_request_threaded_irq(),
> it should be better to check the return value and return
> error if fails.
>
> Fixes: fa659a40b80b ("iio: adc: twl6030-gpadc: Use devm_* API family")
> Signed-off-by: Jiasheng Jiang <[email protected]>
Good find.

That one has been there a long time so I'm not going to rush this in
before the next merge window.

Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to see if we missed anything,

Thanks,

Jonathan

> ---
> drivers/iio/adc/twl6030-gpadc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c
> index afdb59e0b526..d0223e39d59a 100644
> --- a/drivers/iio/adc/twl6030-gpadc.c
> +++ b/drivers/iio/adc/twl6030-gpadc.c
> @@ -911,6 +911,8 @@ static int twl6030_gpadc_probe(struct platform_device *pdev)
> ret = devm_request_threaded_irq(dev, irq, NULL,
> twl6030_gpadc_irq_handler,
> IRQF_ONESHOT, "twl6030_gpadc", indio_dev);
> + if (ret)
> + return ret;
>
> ret = twl6030_gpadc_enable_irq(TWL6030_GPADC_RT_SW1_EOC_MASK);
> if (ret < 0) {