2023-03-14 07:04:57

by Cheng Ziqiu

[permalink] [raw]
Subject: [PATCH v3] iio: adc: at91-sama5d2_adc: remove dead code in `at91_adc_probe`

From the comment of platform_get_irq, it only returns non-zero IRQ
number and negative error number, other than zero.

Fix this by removing the if condition.

Signed-off-by: Cheng Ziqiu <[email protected]>
Reviewed-by: Dongliang Mu <[email protected]>
---
v2->v3: Change subject to make it regular.
v1->v2: Change commit message from SoB to Reviewed-by.
drivers/iio/adc/at91-sama5d2_adc.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index 50d02e5fc6fc..168399092590 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -2400,12 +2400,8 @@ static int at91_adc_probe(struct platform_device *pdev)
st->dma_st.phys_addr = res->start;

st->irq = platform_get_irq(pdev, 0);
- if (st->irq <= 0) {
- if (!st->irq)
- st->irq = -ENXIO;
-
+ if (st->irq < 0)
return st->irq;
- }

st->per_clk = devm_clk_get(&pdev->dev, "adc_clk");
if (IS_ERR(st->per_clk))
--
2.34.1



2023-03-14 10:16:28

by Claudiu Beznea

[permalink] [raw]
Subject: Re: [PATCH v3] iio: adc: at91-sama5d2_adc: remove dead code in `at91_adc_probe`

On 14.03.2023 09:01, Cheng Ziqiu wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
>>From the comment of platform_get_irq, it only returns non-zero IRQ
> number and negative error number, other than zero.
>
> Fix this by removing the if condition.
>
> Signed-off-by: Cheng Ziqiu <[email protected]>
> Reviewed-by: Dongliang Mu <[email protected]>

Reviewed-by: Claudiu Beznea <[email protected]>


> ---
> v2->v3: Change subject to make it regular.
> v1->v2: Change commit message from SoB to Reviewed-by.
> drivers/iio/adc/at91-sama5d2_adc.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
> index 50d02e5fc6fc..168399092590 100644
> --- a/drivers/iio/adc/at91-sama5d2_adc.c
> +++ b/drivers/iio/adc/at91-sama5d2_adc.c
> @@ -2400,12 +2400,8 @@ static int at91_adc_probe(struct platform_device *pdev)
> st->dma_st.phys_addr = res->start;
>
> st->irq = platform_get_irq(pdev, 0);
> - if (st->irq <= 0) {
> - if (!st->irq)
> - st->irq = -ENXIO;
> -
> + if (st->irq < 0)
> return st->irq;
> - }
>
> st->per_clk = devm_clk_get(&pdev->dev, "adc_clk");
> if (IS_ERR(st->per_clk))
> --
> 2.34.1
>

2023-03-18 15:53:37

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH v3] iio: adc: at91-sama5d2_adc: remove dead code in `at91_adc_probe`

On Tue, 14 Mar 2023 10:12:23 +0000
<[email protected]> wrote:

> On 14.03.2023 09:01, Cheng Ziqiu wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >
> >>From the comment of platform_get_irq, it only returns non-zero IRQ
> > number and negative error number, other than zero.
> >
> > Fix this by removing the if condition.
> >
> > Signed-off-by: Cheng Ziqiu <[email protected]>
> > Reviewed-by: Dongliang Mu <[email protected]>
>
> Reviewed-by: Claudiu Beznea <[email protected]>
Applied to the togreg branch of iio.git - initially pushed out as testing for 0-day to
take a look at it.

Thanks,

Jonathan

>
>
> > ---
> > v2->v3: Change subject to make it regular.
> > v1->v2: Change commit message from SoB to Reviewed-by.
> > drivers/iio/adc/at91-sama5d2_adc.c | 6 +-----
> > 1 file changed, 1 insertion(+), 5 deletions(-)
> >
> > diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
> > index 50d02e5fc6fc..168399092590 100644
> > --- a/drivers/iio/adc/at91-sama5d2_adc.c
> > +++ b/drivers/iio/adc/at91-sama5d2_adc.c
> > @@ -2400,12 +2400,8 @@ static int at91_adc_probe(struct platform_device *pdev)
> > st->dma_st.phys_addr = res->start;
> >
> > st->irq = platform_get_irq(pdev, 0);
> > - if (st->irq <= 0) {
> > - if (!st->irq)
> > - st->irq = -ENXIO;
> > -
> > + if (st->irq < 0)
> > return st->irq;
> > - }
> >
> > st->per_clk = devm_clk_get(&pdev->dev, "adc_clk");
> > if (IS_ERR(st->per_clk))
> > --
> > 2.34.1
> >
>