Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1222885 > unrolled thread

[PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ

Started byAlexandre Belloni <alexandre.belloni@free-electrons.com>
First post2015-09-11 16:40 +0200
Last post2015-09-15 00:00 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2015-09-11 16:40 +0200
    Re: [PATCH 2/2] clk: at91: system: don't try to free_irq when there  is no IRQ Boris Brezillon <boris.brezillon@free-electrons.com> - 2015-09-14 16:50 +0200
    Re: [PATCH 2/2] clk: at91: system: don't try to free_irq when there  is no IRQ Stephen Boyd <sboyd@codeaurora.org> - 2015-09-15 00:00 +0200

#1222885 — [PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ

FromAlexandre Belloni <alexandre.belloni@free-electrons.com>
Date2015-09-11 16:40 +0200
Subject[PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ
Message-ID<q7xEC-4px-13@gated-at.bofh.it>
In the error path of at91_clk_register_system(), sys->irq is freed
unconditionally but it may not exist or be request at all.

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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1224209 — Re: [PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ

FromBoris Brezillon <boris.brezillon@free-electrons.com>
Date2015-09-14 16:50 +0200
SubjectRe: [PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ
Message-ID<q8DeW-Je-17@gated-at.bofh.it>
In reply to#1222885
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1224485 — Re: [PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ

FromStephen Boyd <sboyd@codeaurora.org>
Date2015-09-15 00:00 +0200
SubjectRe: [PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ
Message-ID<q8JX4-1Xs-5@gated-at.bofh.it>
In reply to#1222885
On 09/11, Alexandre Belloni 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.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web