public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Fix of_io_request_and_map error handling code
@ 2015-05-02 15:03 Maxime Ripard
  2015-05-02 15:03 ` [PATCH 1/6] clk: asm9260: Fix of_io_request_and_map error check Maxime Ripard
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Maxime Ripard @ 2015-05-02 15:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Maxime Ripard

Hi,

This serie fixes a few drivers that use of_io_request_and_map without
properly checking for the error code.

That should fix all the callers present in the kernel so far.

Maxime

Maxime Ripard (6):
  clk: asm9260: Fix of_io_request_and_map error check
  clk: sunxi: Fix of_io_request_and_map error check
  clocksource: asm9260: Fix of_io_request_and_map error check
  clocksource: integrator: Fix of_io_request_and_map error check
  clocksource: sun5i: Fix of_io_request_and_map error check
  irqchip: vf610: Fix of_io_request_and_map error check

 drivers/clk/clk-asm9260.c                 |  2 +-
 drivers/clk/sunxi/clk-sun9i-core.c        | 10 +++++-----
 drivers/clk/sunxi/clk-sunxi.c             |  2 ++
 drivers/clocksource/asm9260_timer.c       |  2 +-
 drivers/clocksource/timer-integrator-ap.c |  2 +-
 drivers/clocksource/timer-sun5i.c         |  2 +-
 drivers/irqchip/irq-vf610-mscm-ir.c       |  5 ++---
 7 files changed, 13 insertions(+), 12 deletions(-)

-- 
2.3.6


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/6] clk: asm9260: Fix of_io_request_and_map error check
  2015-05-02 15:03 [PATCH 0/6] Fix of_io_request_and_map error handling code Maxime Ripard
@ 2015-05-02 15:03 ` Maxime Ripard
  2015-05-11 19:43   ` Maxime Ripard
  2015-05-02 15:03 ` [PATCH 2/6] clk: sunxi: " Maxime Ripard
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Maxime Ripard @ 2015-05-02 15:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Maxime Ripard, Mike Turquette, Stephen Boyd, linux-clk

of_io_request_and map returns an error pointer, but the current code assumes
that on error the returned pointer will be NULL.

Obviously, that makes the check completely useless. Change the test to actually
check for the proper error code.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Mike Turquette <mturquette@linaro.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-clk@vger.kernel.org
---
 drivers/clk/clk-asm9260.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/clk-asm9260.c b/drivers/clk/clk-asm9260.c
index 88f4ff6916fe..90897af8d9f7 100644
--- a/drivers/clk/clk-asm9260.c
+++ b/drivers/clk/clk-asm9260.c
@@ -274,7 +274,7 @@ static void __init asm9260_acc_init(struct device_node *np)
 	u32 accuracy = 0;
 
 	base = of_io_request_and_map(np, 0, np->name);
-	if (!base)
+	if (IS_ERR(base))
 		panic("%s: unable to map resource", np->name);
 
 	/* register pll */
-- 
2.3.6


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/6] clk: sunxi: Fix of_io_request_and_map error check
  2015-05-02 15:03 [PATCH 0/6] Fix of_io_request_and_map error handling code Maxime Ripard
  2015-05-02 15:03 ` [PATCH 1/6] clk: asm9260: Fix of_io_request_and_map error check Maxime Ripard
@ 2015-05-02 15:03 ` Maxime Ripard
  2015-05-05 15:44   ` Maxime Ripard
  2015-05-02 15:03 ` [PATCH 3/6] clocksource: asm9260: " Maxime Ripard
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Maxime Ripard @ 2015-05-02 15:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Maxime Ripard, Mike Turquette, Stephen Boyd, linux-clk

of_io_request_and map returns an error pointer, but the current code assumes
that on error the returned pointer will be NULL.

Obviously, that makes the check completely useless. Change the test to actually
check for the proper error code.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Mike Turquette <mturquette@linaro.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-clk@vger.kernel.org
---
 drivers/clk/sunxi/clk-sun9i-core.c | 10 +++++-----
 drivers/clk/sunxi/clk-sunxi.c      |  2 ++
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/sunxi/clk-sun9i-core.c b/drivers/clk/sunxi/clk-sun9i-core.c
index d8da77d72861..887f4ea161bb 100644
--- a/drivers/clk/sunxi/clk-sun9i-core.c
+++ b/drivers/clk/sunxi/clk-sun9i-core.c
@@ -93,7 +93,7 @@ static void __init sun9i_a80_pll4_setup(struct device_node *node)
 	void __iomem *reg;
 
 	reg = of_io_request_and_map(node, 0, of_node_full_name(node));
-	if (!reg) {
+	if (IS_ERR(reg)) {
 		pr_err("Could not get registers for a80-pll4-clk: %s\n",
 		       node->name);
 		return;
@@ -154,7 +154,7 @@ static void __init sun9i_a80_gt_setup(struct device_node *node)
 	struct clk *gt;
 
 	reg = of_io_request_and_map(node, 0, of_node_full_name(node));
-	if (!reg) {
+	if (IS_ERR(reg)) {
 		pr_err("Could not get registers for a80-gt-clk: %s\n",
 		       node->name);
 		return;
@@ -218,7 +218,7 @@ static void __init sun9i_a80_ahb_setup(struct device_node *node)
 	void __iomem *reg;
 
 	reg = of_io_request_and_map(node, 0, of_node_full_name(node));
-	if (!reg) {
+	if (IS_ERR(reg)) {
 		pr_err("Could not get registers for a80-ahb-clk: %s\n",
 		       node->name);
 		return;
@@ -244,7 +244,7 @@ static void __init sun9i_a80_apb0_setup(struct device_node *node)
 	void __iomem *reg;
 
 	reg = of_io_request_and_map(node, 0, of_node_full_name(node));
-	if (!reg) {
+	if (IS_ERR(reg)) {
 		pr_err("Could not get registers for a80-apb0-clk: %s\n",
 		       node->name);
 		return;
@@ -310,7 +310,7 @@ static void __init sun9i_a80_apb1_setup(struct device_node *node)
 	void __iomem *reg;
 
 	reg = of_io_request_and_map(node, 0, of_node_full_name(node));
-	if (!reg) {
+	if (IS_ERR(reg)) {
 		pr_err("Could not get registers for a80-apb1-clk: %s\n",
 		       node->name);
 		return;
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index 7e1e2bd189b6..9a82f17d2d73 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -198,6 +198,8 @@ static void __init sun6i_ahb1_clk_setup(struct device_node *node)
 	int i = 0;
 
 	reg = of_io_request_and_map(node, 0, of_node_full_name(node));
+	if (IS_ERR(reg))
+		return;
 
 	/* we have a mux, we will have >1 parents */
 	while (i < SUN6I_AHB1_MAX_PARENTS &&
-- 
2.3.6


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/6] clocksource: asm9260: Fix of_io_request_and_map error check
  2015-05-02 15:03 [PATCH 0/6] Fix of_io_request_and_map error handling code Maxime Ripard
  2015-05-02 15:03 ` [PATCH 1/6] clk: asm9260: Fix of_io_request_and_map error check Maxime Ripard
  2015-05-02 15:03 ` [PATCH 2/6] clk: sunxi: " Maxime Ripard
@ 2015-05-02 15:03 ` Maxime Ripard
  2015-05-05  8:39   ` [tip:timers/core] " tip-bot for Maxime Ripard
  2015-05-02 15:03 ` [PATCH 4/6] clocksource: integrator: " Maxime Ripard
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Maxime Ripard @ 2015-05-02 15:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Maxime Ripard, Daniel Lezcano, Thomas Gleixner

of_io_request_and map returns an error pointer, but the current code assumes
that on error the returned pointer will be NULL.

Obviously, that makes the check completely useless. Change the test to actually
check for the proper error code.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/clocksource/asm9260_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/asm9260_timer.c b/drivers/clocksource/asm9260_timer.c
index 2c9c993727c8..4c2ba59897e8 100644
--- a/drivers/clocksource/asm9260_timer.c
+++ b/drivers/clocksource/asm9260_timer.c
@@ -178,7 +178,7 @@ static void __init asm9260_timer_init(struct device_node *np)
 	unsigned long rate;
 
 	priv.base = of_io_request_and_map(np, 0, np->name);
-	if (!priv.base)
+	if (IS_ERR(priv.base))
 		panic("%s: unable to map resource", np->name);
 
 	clk = of_clk_get(np, 0);
-- 
2.3.6


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/6] clocksource: integrator: Fix of_io_request_and_map error check
  2015-05-02 15:03 [PATCH 0/6] Fix of_io_request_and_map error handling code Maxime Ripard
                   ` (2 preceding siblings ...)
  2015-05-02 15:03 ` [PATCH 3/6] clocksource: asm9260: " Maxime Ripard
@ 2015-05-02 15:03 ` Maxime Ripard
  2015-05-05  8:40   ` [tip:timers/core] " tip-bot for Maxime Ripard
  2015-05-02 15:03 ` [PATCH 5/6] clocksource: sun5i: " Maxime Ripard
  2015-05-02 15:03 ` [PATCH 6/6] irqchip: vf610: " Maxime Ripard
  5 siblings, 1 reply; 14+ messages in thread
From: Maxime Ripard @ 2015-05-02 15:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Maxime Ripard, Daniel Lezcano, Thomas Gleixner

of_io_request_and map returns an error pointer, but the current code assumes
that on error the returned pointer will be NULL.

Obviously, that makes the check completely useless. Change the test to actually
check for the proper error code.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/clocksource/timer-integrator-ap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-integrator-ap.c b/drivers/clocksource/timer-integrator-ap.c
index b9efd30513d5..c97d1980c0f8 100644
--- a/drivers/clocksource/timer-integrator-ap.c
+++ b/drivers/clocksource/timer-integrator-ap.c
@@ -166,7 +166,7 @@ static void __init integrator_ap_timer_init_of(struct device_node *node)
 	struct device_node *sec_node;
 
 	base = of_io_request_and_map(node, 0, "integrator-timer");
-	if (!base)
+	if (IS_ERR(base))
 		return;
 
 	clk = of_clk_get(node, 0);
-- 
2.3.6


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/6] clocksource: sun5i: Fix of_io_request_and_map error check
  2015-05-02 15:03 [PATCH 0/6] Fix of_io_request_and_map error handling code Maxime Ripard
                   ` (3 preceding siblings ...)
  2015-05-02 15:03 ` [PATCH 4/6] clocksource: integrator: " Maxime Ripard
@ 2015-05-02 15:03 ` Maxime Ripard
  2015-05-05  8:40   ` [tip:timers/core] " tip-bot for Maxime Ripard
  2015-05-02 15:03 ` [PATCH 6/6] irqchip: vf610: " Maxime Ripard
  5 siblings, 1 reply; 14+ messages in thread
From: Maxime Ripard @ 2015-05-02 15:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Maxime Ripard, Daniel Lezcano, Thomas Gleixner

of_io_request_and map returns an error pointer, but the current code assumes
that on error the returned pointer will be NULL.

Obviously, that makes the check completely useless. Change the test to actually
check for the proper error code.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/clocksource/timer-sun5i.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-sun5i.c b/drivers/clocksource/timer-sun5i.c
index 28aa4b7bb602..0ffb4ea7c925 100644
--- a/drivers/clocksource/timer-sun5i.c
+++ b/drivers/clocksource/timer-sun5i.c
@@ -324,7 +324,7 @@ static void __init sun5i_timer_init(struct device_node *node)
 	int irq;
 
 	timer_base = of_io_request_and_map(node, 0, of_node_full_name(node));
-	if (!timer_base)
+	if (IS_ERR(timer_base))
 		panic("Can't map registers");
 
 	irq = irq_of_parse_and_map(node, 0);
-- 
2.3.6


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 6/6] irqchip: vf610: Fix of_io_request_and_map error check
  2015-05-02 15:03 [PATCH 0/6] Fix of_io_request_and_map error handling code Maxime Ripard
                   ` (4 preceding siblings ...)
  2015-05-02 15:03 ` [PATCH 5/6] clocksource: sun5i: " Maxime Ripard
@ 2015-05-02 15:03 ` Maxime Ripard
  2015-05-05  8:50   ` [tip:irq/core] " tip-bot for Maxime Ripard
  5 siblings, 1 reply; 14+ messages in thread
From: Maxime Ripard @ 2015-05-02 15:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Maxime Ripard, Jason Cooper, Thomas Gleixner

of_io_request_and map returns an error pointer, but the current code assumes
that on error the returned pointer will be NULL.

Obviously, that makes the check completely useless. Change the test to actually
check for the proper error code.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/irqchip/irq-vf610-mscm-ir.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/irqchip/irq-vf610-mscm-ir.c b/drivers/irqchip/irq-vf610-mscm-ir.c
index 9521057d4744..d0f940a3516d 100644
--- a/drivers/irqchip/irq-vf610-mscm-ir.c
+++ b/drivers/irqchip/irq-vf610-mscm-ir.c
@@ -174,10 +174,9 @@ static int __init vf610_mscm_ir_of_init(struct device_node *node,
 		return -ENOMEM;
 
 	mscm_ir_data->mscm_ir_base = of_io_request_and_map(node, 0, "mscm-ir");
-
-	if (!mscm_ir_data->mscm_ir_base) {
+	if (IS_ERR(mscm_ir_data->mscm_ir_base)) {
 		pr_err("vf610_mscm_ir: unable to map mscm register\n");
-		ret = -ENOMEM;
+		ret = PTR_ERR(mscm_ir_data->mscm_ir_base);
 		goto out_free;
 	}
 
-- 
2.3.6


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [tip:timers/core] clocksource: asm9260: Fix of_io_request_and_map error check
  2015-05-02 15:03 ` [PATCH 3/6] clocksource: asm9260: " Maxime Ripard
@ 2015-05-05  8:39   ` tip-bot for Maxime Ripard
  0 siblings, 0 replies; 14+ messages in thread
From: tip-bot for Maxime Ripard @ 2015-05-05  8:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, maxime.ripard, mingo, linux-kernel, daniel.lezcano, tglx

Commit-ID:  ff569fcd7123d9a9176d59174a27bab9a4fad328
Gitweb:     http://git.kernel.org/tip/ff569fcd7123d9a9176d59174a27bab9a4fad328
Author:     Maxime Ripard <maxime.ripard@free-electrons.com>
AuthorDate: Sat, 2 May 2015 17:03:23 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 5 May 2015 10:35:58 +0200

clocksource: asm9260: Fix of_io_request_and_map error check

of_io_request_and map returns an error pointer, but the current code assumes
that on error the returned pointer will be NULL.

Obviously, that makes the check completely useless. Change the test to actually
check for the proper error code.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: http://lkml.kernel.org/r/1430579006-32702-4-git-send-email-maxime.ripard@free-electrons.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/clocksource/asm9260_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/asm9260_timer.c b/drivers/clocksource/asm9260_timer.c
index 2c9c993..4c2ba59 100644
--- a/drivers/clocksource/asm9260_timer.c
+++ b/drivers/clocksource/asm9260_timer.c
@@ -178,7 +178,7 @@ static void __init asm9260_timer_init(struct device_node *np)
 	unsigned long rate;
 
 	priv.base = of_io_request_and_map(np, 0, np->name);
-	if (!priv.base)
+	if (IS_ERR(priv.base))
 		panic("%s: unable to map resource", np->name);
 
 	clk = of_clk_get(np, 0);

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [tip:timers/core] clocksource: integrator: Fix of_io_request_and_map error check
  2015-05-02 15:03 ` [PATCH 4/6] clocksource: integrator: " Maxime Ripard
@ 2015-05-05  8:40   ` tip-bot for Maxime Ripard
  0 siblings, 0 replies; 14+ messages in thread
From: tip-bot for Maxime Ripard @ 2015-05-05  8:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, maxime.ripard, daniel.lezcano, tglx

Commit-ID:  bd580e7ed4add8ce9b2c1dd1911f8fb9d444128b
Gitweb:     http://git.kernel.org/tip/bd580e7ed4add8ce9b2c1dd1911f8fb9d444128b
Author:     Maxime Ripard <maxime.ripard@free-electrons.com>
AuthorDate: Sat, 2 May 2015 17:03:24 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 5 May 2015 10:35:58 +0200

clocksource: integrator: Fix of_io_request_and_map error check

of_io_request_and map returns an error pointer, but the current code assumes
that on error the returned pointer will be NULL.

Obviously, that makes the check completely useless. Change the test to actually
check for the proper error code.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: http://lkml.kernel.org/r/1430579006-32702-5-git-send-email-maxime.ripard@free-electrons.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/clocksource/timer-integrator-ap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-integrator-ap.c b/drivers/clocksource/timer-integrator-ap.c
index b9efd30..c97d198 100644
--- a/drivers/clocksource/timer-integrator-ap.c
+++ b/drivers/clocksource/timer-integrator-ap.c
@@ -166,7 +166,7 @@ static void __init integrator_ap_timer_init_of(struct device_node *node)
 	struct device_node *sec_node;
 
 	base = of_io_request_and_map(node, 0, "integrator-timer");
-	if (!base)
+	if (IS_ERR(base))
 		return;
 
 	clk = of_clk_get(node, 0);

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [tip:timers/core] clocksource: sun5i: Fix of_io_request_and_map error check
  2015-05-02 15:03 ` [PATCH 5/6] clocksource: sun5i: " Maxime Ripard
@ 2015-05-05  8:40   ` tip-bot for Maxime Ripard
  0 siblings, 0 replies; 14+ messages in thread
From: tip-bot for Maxime Ripard @ 2015-05-05  8:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, linux-kernel, maxime.ripard, hpa, daniel.lezcano, tglx

Commit-ID:  9fa8cc0a85c774b75218ba5f385792be387c190b
Gitweb:     http://git.kernel.org/tip/9fa8cc0a85c774b75218ba5f385792be387c190b
Author:     Maxime Ripard <maxime.ripard@free-electrons.com>
AuthorDate: Sat, 2 May 2015 17:03:25 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 5 May 2015 10:35:58 +0200

clocksource: sun5i: Fix of_io_request_and_map error check

of_io_request_and map returns an error pointer, but the current code assumes
that on error the returned pointer will be NULL.

Obviously, that makes the check completely useless. Change the test to actually
check for the proper error code.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: http://lkml.kernel.org/r/1430579006-32702-6-git-send-email-maxime.ripard@free-electrons.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/clocksource/timer-sun5i.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-sun5i.c b/drivers/clocksource/timer-sun5i.c
index 28aa4b7..0ffb4ea 100644
--- a/drivers/clocksource/timer-sun5i.c
+++ b/drivers/clocksource/timer-sun5i.c
@@ -324,7 +324,7 @@ static void __init sun5i_timer_init(struct device_node *node)
 	int irq;
 
 	timer_base = of_io_request_and_map(node, 0, of_node_full_name(node));
-	if (!timer_base)
+	if (IS_ERR(timer_base))
 		panic("Can't map registers");
 
 	irq = irq_of_parse_and_map(node, 0);

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [tip:irq/core] irqchip: vf610: Fix of_io_request_and_map error check
  2015-05-02 15:03 ` [PATCH 6/6] irqchip: vf610: " Maxime Ripard
@ 2015-05-05  8:50   ` tip-bot for Maxime Ripard
  0 siblings, 0 replies; 14+ messages in thread
From: tip-bot for Maxime Ripard @ 2015-05-05  8:50 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, maxime.ripard, jason, tglx, hpa, mingo

Commit-ID:  dbf07cf0c846c3a0d3f97976931cb4ae78f730e2
Gitweb:     http://git.kernel.org/tip/dbf07cf0c846c3a0d3f97976931cb4ae78f730e2
Author:     Maxime Ripard <maxime.ripard@free-electrons.com>
AuthorDate: Sat, 2 May 2015 17:03:26 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 5 May 2015 10:45:59 +0200

irqchip: vf610: Fix of_io_request_and_map error check

of_io_request_and map returns an error pointer, but the current code assumes
that on error the returned pointer will be NULL.

Obviously, that makes the check completely useless. Change the test to actually
check for the proper error code.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Link: http://lkml.kernel.org/r/1430579006-32702-7-git-send-email-maxime.ripard@free-electrons.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/irqchip/irq-vf610-mscm-ir.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/irqchip/irq-vf610-mscm-ir.c b/drivers/irqchip/irq-vf610-mscm-ir.c
index 9521057..d0f940a 100644
--- a/drivers/irqchip/irq-vf610-mscm-ir.c
+++ b/drivers/irqchip/irq-vf610-mscm-ir.c
@@ -174,10 +174,9 @@ static int __init vf610_mscm_ir_of_init(struct device_node *node,
 		return -ENOMEM;
 
 	mscm_ir_data->mscm_ir_base = of_io_request_and_map(node, 0, "mscm-ir");
-
-	if (!mscm_ir_data->mscm_ir_base) {
+	if (IS_ERR(mscm_ir_data->mscm_ir_base)) {
 		pr_err("vf610_mscm_ir: unable to map mscm register\n");
-		ret = -ENOMEM;
+		ret = PTR_ERR(mscm_ir_data->mscm_ir_base);
 		goto out_free;
 	}
 

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/6] clk: sunxi: Fix of_io_request_and_map error check
  2015-05-02 15:03 ` [PATCH 2/6] clk: sunxi: " Maxime Ripard
@ 2015-05-05 15:44   ` Maxime Ripard
  0 siblings, 0 replies; 14+ messages in thread
From: Maxime Ripard @ 2015-05-05 15:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: Mike Turquette, Stephen Boyd, linux-clk

[-- Attachment #1: Type: text/plain, Size: 658 bytes --]

On Sat, May 02, 2015 at 05:03:22PM +0200, Maxime Ripard wrote:
> of_io_request_and map returns an error pointer, but the current code assumes
> that on error the returned pointer will be NULL.
> 
> Obviously, that makes the check completely useless. Change the test to actually
> check for the proper error code.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Mike Turquette <mturquette@linaro.org>
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Cc: linux-clk@vger.kernel.org

Applied on my tree.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/6] clk: asm9260: Fix of_io_request_and_map error check
  2015-05-02 15:03 ` [PATCH 1/6] clk: asm9260: Fix of_io_request_and_map error check Maxime Ripard
@ 2015-05-11 19:43   ` Maxime Ripard
  2015-05-13  7:35     ` Stephen Boyd
  0 siblings, 1 reply; 14+ messages in thread
From: Maxime Ripard @ 2015-05-11 19:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Mike Turquette, Stephen Boyd, linux-clk

[-- Attachment #1: Type: text/plain, Size: 765 bytes --]

Mike, Stephen,

On Sat, May 02, 2015 at 05:03:21PM +0200, Maxime Ripard wrote:
> of_io_request_and map returns an error pointer, but the current code assumes
> that on error the returned pointer will be NULL.
> 
> Obviously, that makes the check completely useless. Change the test to actually
> check for the proper error code.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Mike Turquette <mturquette@linaro.org>
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Cc: linux-clk@vger.kernel.org

There doesn't seem to be a sub-maintainer for that driver, I guess it
should go through your tree?

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/6] clk: asm9260: Fix of_io_request_and_map error check
  2015-05-11 19:43   ` Maxime Ripard
@ 2015-05-13  7:35     ` Stephen Boyd
  0 siblings, 0 replies; 14+ messages in thread
From: Stephen Boyd @ 2015-05-13  7:35 UTC (permalink / raw)
  To: Maxime Ripard; +Cc: linux-kernel, Mike Turquette, linux-clk

On 05/11, Maxime Ripard wrote:
> Mike, Stephen,
> 
> On Sat, May 02, 2015 at 05:03:21PM +0200, Maxime Ripard wrote:
> > of_io_request_and map returns an error pointer, but the current code assumes
> > that on error the returned pointer will be NULL.
> > 
> > Obviously, that makes the check completely useless. Change the test to actually
> > check for the proper error code.
> > 
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > Cc: Mike Turquette <mturquette@linaro.org>
> > Cc: Stephen Boyd <sboyd@codeaurora.org>
> > Cc: linux-clk@vger.kernel.org
> 
> There doesn't seem to be a sub-maintainer for that driver, I guess it
> should go through your tree?
> 

Yep. Applied to clk-next.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-05-13  7:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-02 15:03 [PATCH 0/6] Fix of_io_request_and_map error handling code Maxime Ripard
2015-05-02 15:03 ` [PATCH 1/6] clk: asm9260: Fix of_io_request_and_map error check Maxime Ripard
2015-05-11 19:43   ` Maxime Ripard
2015-05-13  7:35     ` Stephen Boyd
2015-05-02 15:03 ` [PATCH 2/6] clk: sunxi: " Maxime Ripard
2015-05-05 15:44   ` Maxime Ripard
2015-05-02 15:03 ` [PATCH 3/6] clocksource: asm9260: " Maxime Ripard
2015-05-05  8:39   ` [tip:timers/core] " tip-bot for Maxime Ripard
2015-05-02 15:03 ` [PATCH 4/6] clocksource: integrator: " Maxime Ripard
2015-05-05  8:40   ` [tip:timers/core] " tip-bot for Maxime Ripard
2015-05-02 15:03 ` [PATCH 5/6] clocksource: sun5i: " Maxime Ripard
2015-05-05  8:40   ` [tip:timers/core] " tip-bot for Maxime Ripard
2015-05-02 15:03 ` [PATCH 6/6] irqchip: vf610: " Maxime Ripard
2015-05-05  8:50   ` [tip:irq/core] " tip-bot for Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox