2019-12-04 02:05:22

by Mao Wenan

[permalink] [raw]
Subject: [PATCH -next] rtc: mt6397: drop free_irq of devm_xx allocated irq

rtc->irq is requested by devm_request_threaded_irq,
and request_threaded_irq. IRQs requested with this
function will be automatically freed on driver detach.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Mao Wenan <[email protected]>
---
drivers/rtc/rtc-mt6397.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
index 5249fc99fd5f..d6a10111137a 100644
--- a/drivers/rtc/rtc-mt6397.c
+++ b/drivers/rtc/rtc-mt6397.c
@@ -293,7 +293,6 @@ static int mtk_rtc_probe(struct platform_device *pdev)
return 0;

out_free_irq:
- free_irq(rtc->irq, rtc);
return ret;
}

--
2.20.1


2019-12-04 06:38:19

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH -next] rtc: mt6397: drop free_irq of devm_xx allocated irq

On Wed, Dec 04, 2019 at 10:02:09AM +0800, Mao Wenan wrote:
> rtc->irq is requested by devm_request_threaded_irq,
> and request_threaded_irq. IRQs requested with this
> function will be automatically freed on driver detach.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Mao Wenan <[email protected]>
> ---
> drivers/rtc/rtc-mt6397.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
> index 5249fc99fd5f..d6a10111137a 100644
> --- a/drivers/rtc/rtc-mt6397.c
> +++ b/drivers/rtc/rtc-mt6397.c
> @@ -293,7 +293,6 @@ static int mtk_rtc_probe(struct platform_device *pdev)
> return 0;
>
> out_free_irq:
> - free_irq(rtc->irq, rtc);
> return ret;

Please get rid of the error label as well.

regards,
dan carpenter

2019-12-04 07:31:41

by Mao Wenan

[permalink] [raw]
Subject: [PATCH v2 -next] rtc: mt6397: drop free_irq of devm_xx allocated irq

rtc->irq is requested by devm_request_threaded_irq,
and request_threaded_irq. IRQs requested with this
function will be automatically freed on driver detach.
This patch remove unused error label as well.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Mao Wenan <[email protected]>
---
v2: remove error label as Dan Carpenter suggest.
drivers/rtc/rtc-mt6397.c | 7 -------
1 file changed, 7 deletions(-)

diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
index 5249fc99fd5f..14f3c4915260 100644
--- a/drivers/rtc/rtc-mt6397.c
+++ b/drivers/rtc/rtc-mt6397.c
@@ -287,13 +287,6 @@ static int mtk_rtc_probe(struct platform_device *pdev)
rtc->rtc_dev->ops = &mtk_rtc_ops;

ret = rtc_register_device(rtc->rtc_dev);
- if (ret)
- goto out_free_irq;
-
- return 0;
-
-out_free_irq:
- free_irq(rtc->irq, rtc);
return ret;
}

--
2.20.1

2019-12-04 08:41:44

by Alexandre Belloni

[permalink] [raw]
Subject: Re: [PATCH v2 -next] rtc: mt6397: drop free_irq of devm_xx allocated irq

On 04/12/2019 15:28:26+0800, Mao Wenan wrote:
> rtc->irq is requested by devm_request_threaded_irq,
> and request_threaded_irq. IRQs requested with this
> function will be automatically freed on driver detach.
> This patch remove unused error label as well.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Mao Wenan <[email protected]>
> ---
> v2: remove error label as Dan Carpenter suggest.
> drivers/rtc/rtc-mt6397.c | 7 -------
> 1 file changed, 7 deletions(-)
>
> diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
> index 5249fc99fd5f..14f3c4915260 100644
> --- a/drivers/rtc/rtc-mt6397.c
> +++ b/drivers/rtc/rtc-mt6397.c
> @@ -287,13 +287,6 @@ static int mtk_rtc_probe(struct platform_device *pdev)
> rtc->rtc_dev->ops = &mtk_rtc_ops;
>
> ret = rtc_register_device(rtc->rtc_dev);
> - if (ret)
> - goto out_free_irq;
> -
> - return 0;
> -
> -out_free_irq:
> - free_irq(rtc->irq, rtc);
> return ret;

Maybe return rtc_register_device(rtc->rtc_dev);

> }
>
> --
> 2.20.1
>

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2019-12-04 08:43:42

by Alexandre Belloni

[permalink] [raw]
Subject: Re: [PATCH v2 -next] rtc: mt6397: drop free_irq of devm_xx allocated irq

On 04/12/2019 09:40:38+0100, Alexandre Belloni wrote:
> On 04/12/2019 15:28:26+0800, Mao Wenan wrote:
> > rtc->irq is requested by devm_request_threaded_irq,
> > and request_threaded_irq. IRQs requested with this
> > function will be automatically freed on driver detach.
> > This patch remove unused error label as well.
> >
> > Reported-by: Hulk Robot <[email protected]>
> > Signed-off-by: Mao Wenan <[email protected]>
> > ---
> > v2: remove error label as Dan Carpenter suggest.
> > drivers/rtc/rtc-mt6397.c | 7 -------
> > 1 file changed, 7 deletions(-)
> >
> > diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
> > index 5249fc99fd5f..14f3c4915260 100644
> > --- a/drivers/rtc/rtc-mt6397.c
> > +++ b/drivers/rtc/rtc-mt6397.c
> > @@ -287,13 +287,6 @@ static int mtk_rtc_probe(struct platform_device *pdev)
> > rtc->rtc_dev->ops = &mtk_rtc_ops;
> >
> > ret = rtc_register_device(rtc->rtc_dev);
> > - if (ret)
> > - goto out_free_irq;
> > -
> > - return 0;
> > -
> > -out_free_irq:
> > - free_irq(rtc->irq, rtc);
> > return ret;
>
> Maybe return rtc_register_device(rtc->rtc_dev);
>

By the way, this was already properly submitted here:
https://patchwork.ozlabs.org/patch/1193956/

So I'll apply this one once the merge window ends (it depends on the MFD
pull request, that is why I didn't apply it yet).


--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com