All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: tglx@linutronix.de
Cc: linux@arm.linux.org.uk, Heiko Stuebner <heiko@sntech.de>,
	linux-kernel@vger.kernel.org (open list:CLOCKSOURCE, CLOC...),
	linux-arm-kernel@lists.infradead.org (moderated
	list:ARM/Rockchip SoC...),
	linux-rockchip@lists.infradead.org (open list:ARM/Rockchip
	SoC...)
Subject: [PATCH 1/2] clocksource/drivers/rockchip: Fix bad NO_IRQ usage
Date: Wed, 30 Sep 2015 12:08:29 +0200	[thread overview]
Message-ID: <1443607710-10415-1-git-send-email-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <560BB452.1020000@linaro.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 <daniel.lezcano@linaro.org>
---
 drivers/clocksource/rockchip_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/rockchip_timer.c b/drivers/clocksource/rockchip_timer.c
index bb2c2b0..d3c1742 100644
--- a/drivers/clocksource/rockchip_timer.c
+++ b/drivers/clocksource/rockchip_timer.c
@@ -148,7 +148,7 @@ static void __init rk_timer_init(struct device_node *np)
 	bc_timer.freq = clk_get_rate(timer_clk);
 
 	irq = irq_of_parse_and_map(np, 0);
-	if (irq == NO_IRQ) {
+	if (!irq) {
 		pr_err("Failed to map interrupts for '%s'\n", TIMER_NAME);
 		return;
 	}
-- 
1.9.1


WARNING: multiple messages have this Message-ID (diff)
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: tglx@linutronix.de
Cc: linux@arm.linux.org.uk, Heiko Stuebner <heiko@sntech.de>,
	"open list:CLOCKSOURCE, CLOC..." <linux-kernel@vger.kernel.org>,
	"moderated list:ARM/Rockchip SoC..."
	<linux-arm-kernel@lists.infradead.org>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>
Subject: [PATCH 1/2] clocksource/drivers/rockchip: Fix bad NO_IRQ usage
Date: Wed, 30 Sep 2015 12:08:29 +0200	[thread overview]
Message-ID: <1443607710-10415-1-git-send-email-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <560BB452.1020000@linaro.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 <daniel.lezcano@linaro.org>
---
 drivers/clocksource/rockchip_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/rockchip_timer.c b/drivers/clocksource/rockchip_timer.c
index bb2c2b0..d3c1742 100644
--- a/drivers/clocksource/rockchip_timer.c
+++ b/drivers/clocksource/rockchip_timer.c
@@ -148,7 +148,7 @@ static void __init rk_timer_init(struct device_node *np)
 	bc_timer.freq = clk_get_rate(timer_clk);
 
 	irq = irq_of_parse_and_map(np, 0);
-	if (irq == NO_IRQ) {
+	if (!irq) {
 		pr_err("Failed to map interrupts for '%s'\n", TIMER_NAME);
 		return;
 	}
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: daniel.lezcano@linaro.org (Daniel Lezcano)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] clocksource/drivers/rockchip: Fix bad NO_IRQ usage
Date: Wed, 30 Sep 2015 12:08:29 +0200	[thread overview]
Message-ID: <1443607710-10415-1-git-send-email-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <560BB452.1020000@linaro.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 <daniel.lezcano@linaro.org>
---
 drivers/clocksource/rockchip_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/rockchip_timer.c b/drivers/clocksource/rockchip_timer.c
index bb2c2b0..d3c1742 100644
--- a/drivers/clocksource/rockchip_timer.c
+++ b/drivers/clocksource/rockchip_timer.c
@@ -148,7 +148,7 @@ static void __init rk_timer_init(struct device_node *np)
 	bc_timer.freq = clk_get_rate(timer_clk);
 
 	irq = irq_of_parse_and_map(np, 0);
-	if (irq == NO_IRQ) {
+	if (!irq) {
 		pr_err("Failed to map interrupts for '%s'\n", TIMER_NAME);
 		return;
 	}
-- 
1.9.1

  reply	other threads:[~2015-09-30 10:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30 10:07 [GIT PULL] clockevents: a couple of fixes 4.3 Daniel Lezcano
2015-09-30 10:07 ` Daniel Lezcano
2015-09-30 10:08 ` Daniel Lezcano [this message]
2015-09-30 10:08   ` [PATCH 1/2] clocksource/drivers/rockchip: Fix bad NO_IRQ usage Daniel Lezcano
2015-09-30 10:08   ` Daniel Lezcano
2015-09-30 10:08   ` [PATCH 2/2] clocksource/drivers/keystone: " Daniel Lezcano
2015-09-30 10:08     ` Daniel Lezcano
2015-09-30 15:26     ` santosh shilimkar
2015-09-30 15:26       ` santosh shilimkar
2015-09-30 10:17   ` [PATCH 1/2] clocksource/drivers/rockchip: " Caesar Wang
2015-09-30 10:17     ` Caesar Wang
2015-09-30 10:17     ` Caesar Wang

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=1443607710-10415-1-git-send-email-daniel.lezcano@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=heiko@sntech.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.