From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756308AbbI3KI7 (ORCPT ); Wed, 30 Sep 2015 06:08:59 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:36053 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756200AbbI3KIx (ORCPT ); Wed, 30 Sep 2015 06:08:53 -0400 From: Daniel Lezcano To: tglx@linutronix.de Cc: linux@arm.linux.org.uk, Santosh Shilimkar , linux-arm-kernel@lists.infradead.org (moderated list:ARM/TEXAS INSTRUM...), linux-kernel@vger.kernel.org (open list:ARM/TEXAS INSTRUM...) Subject: [PATCH 2/2] clocksource/drivers/keystone: Fix bad NO_IRQ usage Date: Wed, 30 Sep 2015 12:08:30 +0200 Message-Id: <1443607710-10415-2-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1443607710-10415-1-git-send-email-daniel.lezcano@linaro.org> References: <560BB452.1020000@linaro.org> <1443607710-10415-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current code assumes the 'irq_of_parse_and_map' will return NO_IRQ in case of failure. Unfortunately, the NO_IRQ is not consistent across the different architectures and we must not rely on it. NO_IRQ is equal to '-1' on ARM and 'irq_of_parse_and_map' returns '0' in case of an error. Hence, the latter won't be detected and will lead to a crash. Fix this by just checking 'irq' is different from zero. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-keystone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clocksource/timer-keystone.c b/drivers/clocksource/timer-keystone.c index edacf39..1cea08c 100644 --- a/drivers/clocksource/timer-keystone.c +++ b/drivers/clocksource/timer-keystone.c @@ -152,7 +152,7 @@ static void __init keystone_timer_init(struct device_node *np) int irq, error; irq = irq_of_parse_and_map(np, 0); - if (irq == NO_IRQ) { + if (!irq) { pr_err("%s: failed to map interrupts\n", __func__); return; } -- 1.9.1