From: boris.brezillon@free-electrons.com (Boris Brezillon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ
Date: Mon, 14 Sep 2015 16:40:28 +0200 [thread overview]
Message-ID: <20150914164028.7f38505d@bbrezillon> (raw)
In-Reply-To: <1441982047-11303-2-git-send-email-alexandre.belloni@free-electrons.com>
Hi Alexandre,
On Fri, 11 Sep 2015 16:34:07 +0200
Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:
> In the error path of at91_clk_register_system(), sys->irq is freed
> unconditionally but it may not exist or be request at all.
Not sure this is really needed since free_irq() seems to gracefully
handle the case where the irq has not been previously requested [1]
(it does not complain about invalid irq descriptors), but I guess
this extra check cannot hurt.
BTW, that's kinda weird that free_irq() accepts this case, but complains
when you're trying to free a wrong (or already freed) shared irq handler
[2].
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Best Regards,
Boris
[1]http://lxr.free-electrons.com/source/kernel/irq/manage.c#L1471
[2]http://lxr.free-electrons.com/source/kernel/irq/manage.c#L1377
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
> drivers/clk/at91/clk-system.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/at91/clk-system.c b/drivers/clk/at91/clk-system.c
> index 58008b3e8bc1..3f5314344286 100644
> --- a/drivers/clk/at91/clk-system.c
> +++ b/drivers/clk/at91/clk-system.c
> @@ -138,7 +138,8 @@ at91_clk_register_system(struct at91_pmc *pmc, const char *name,
>
> clk = clk_register(NULL, &sys->hw);
> if (IS_ERR(clk)) {
> - free_irq(sys->irq, sys);
> + if (irq)
> + free_irq(sys->irq, sys);
> kfree(sys);
> }
>
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
next prev parent reply other threads:[~2015-09-14 14:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-11 14:34 [PATCH 1/2] clk: at91: utmi: use pmc_read when the at91_pmc is available Alexandre Belloni
2015-09-11 14:34 ` [PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ Alexandre Belloni
2015-09-14 14:40 ` Boris Brezillon [this message]
2015-09-14 21:57 ` Stephen Boyd
2015-09-14 14:31 ` [PATCH 1/2] clk: at91: utmi: use pmc_read when the at91_pmc is available Boris Brezillon
2015-09-14 21:57 ` Stephen Boyd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150914164028.7f38505d@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).