Re: [PATCH] clocksource: dw_apb: fix error check

From: Daniel Lezcano
Date: Mon May 27 2013 - 09:14:32 EST


On 05/27/2013 01:51 PM, Baruch Siach wrote:
> irq_of_parse_and_map() returns 0 on error, while the code checks for NO_IRQ.
> This breaks on platforms that have NO_IRQ != 0.
>
> Cc: <stable@xxxxxxxxxxxxxxx>
> Signed-off-by: Baruch Siach <baruch@xxxxxxxxxx>
> ---

Shouldn't the 'irq_of_parse_and_map' function to be fixed and return
NO_IRQ in case of error ? (even if some code checks the return value is
'zero' in case of error [1], while some other code checks NO_IRQ [2]).

[1]
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/x86/kernel/devicetree.c#n124

[2]
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/sysdev/fsl_msi.c#n344


> drivers/clocksource/dw_apb_timer_of.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
> index 9fdb4d3..843d43b 100644
> --- a/drivers/clocksource/dw_apb_timer_of.c
> +++ b/drivers/clocksource/dw_apb_timer_of.c
> @@ -47,7 +47,7 @@ static void add_clockevent(struct device_node *event_timer)
> u32 irq, rate;
>
> irq = irq_of_parse_and_map(event_timer, 0);
> - if (irq == NO_IRQ)
> + if (irq == 0)
> panic("No IRQ for clock event timer");
>
> timer_get_base_and_rate(event_timer, &iobase, &rate);
>


--
<http://www.linaro.org/> Linaro.org â Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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