linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clocksource/drivers/timer-of: check return value of of_iomap in timer_of_base_init()
@ 2022-03-07 17:26 Guillaume Ranquet
  2022-03-14  9:28 ` [tip: timers/core] clocksource/drivers/timer-of: Check " tip-bot2 for Guillaume Ranquet
  0 siblings, 1 reply; 2+ messages in thread
From: Guillaume Ranquet @ 2022-03-07 17:26 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner, Benjamin Gaignard, Ingo Molnar
  Cc: linux-kernel

of_base->base can either be iomapped using of_io_request_and_map() or
of_iomap() depending whether or not an of_base->name has been set.

Thus check of_base->base against NULL as of_iomap() does not return a
PTR_ERR() in case of error.

Fixes: 9aea417afa6b ("clocksource/drivers/timer-of: Don't request the resource by name")
Signed-off-by: Guillaume Ranquet <granquet@baylibre.com>
---
 drivers/clocksource/timer-of.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/clocksource/timer-of.c b/drivers/clocksource/timer-of.c
index 529cc6a51cdb3..c3f54d9912be7 100644
--- a/drivers/clocksource/timer-of.c
+++ b/drivers/clocksource/timer-of.c
@@ -157,9 +157,9 @@ static __init int timer_of_base_init(struct device_node *np,
 	of_base->base = of_base->name ?
 		of_io_request_and_map(np, of_base->index, of_base->name) :
 		of_iomap(np, of_base->index);
-	if (IS_ERR(of_base->base)) {
-		pr_err("Failed to iomap (%s)\n", of_base->name);
-		return PTR_ERR(of_base->base);
+	if (IS_ERR_OR_NULL(of_base->base)) {
+		pr_err("Failed to iomap (%s:%s)\n", np->name, of_base->name);
+		return of_base->base ? PTR_ERR(of_base->base) : -ENOMEM;
 	}
 
 	return 0;
-- 
2.34.1


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

* [tip: timers/core] clocksource/drivers/timer-of: Check return value of of_iomap in timer_of_base_init()
  2022-03-07 17:26 [PATCH] clocksource/drivers/timer-of: check return value of of_iomap in timer_of_base_init() Guillaume Ranquet
@ 2022-03-14  9:28 ` tip-bot2 for Guillaume Ranquet
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Guillaume Ranquet @ 2022-03-14  9:28 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Guillaume Ranquet, Daniel Lezcano, x86, linux-kernel

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     4467b8bad2401794fb89a0268c8c8257180bf60f
Gitweb:        https://git.kernel.org/tip/4467b8bad2401794fb89a0268c8c8257180bf60f
Author:        Guillaume Ranquet <granquet@baylibre.com>
AuthorDate:    Mon, 07 Mar 2022 18:26:56 +01:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Mon, 07 Mar 2022 19:21:25 +01:00

clocksource/drivers/timer-of: Check return value of of_iomap in timer_of_base_init()

of_base->base can either be iomapped using of_io_request_and_map() or
of_iomap() depending whether or not an of_base->name has been set.

Thus check of_base->base against NULL as of_iomap() does not return a
PTR_ERR() in case of error.

Fixes: 9aea417afa6b ("clocksource/drivers/timer-of: Don't request the resource by name")
Signed-off-by: Guillaume Ranquet <granquet@baylibre.com>
Link: https://lore.kernel.org/r/20220307172656.4836-1-granquet@baylibre.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/timer-of.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/clocksource/timer-of.c b/drivers/clocksource/timer-of.c
index 529cc6a..c3f54d9 100644
--- a/drivers/clocksource/timer-of.c
+++ b/drivers/clocksource/timer-of.c
@@ -157,9 +157,9 @@ static __init int timer_of_base_init(struct device_node *np,
 	of_base->base = of_base->name ?
 		of_io_request_and_map(np, of_base->index, of_base->name) :
 		of_iomap(np, of_base->index);
-	if (IS_ERR(of_base->base)) {
-		pr_err("Failed to iomap (%s)\n", of_base->name);
-		return PTR_ERR(of_base->base);
+	if (IS_ERR_OR_NULL(of_base->base)) {
+		pr_err("Failed to iomap (%s:%s)\n", np->name, of_base->name);
+		return of_base->base ? PTR_ERR(of_base->base) : -ENOMEM;
 	}
 
 	return 0;

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

end of thread, other threads:[~2022-03-14  9:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-07 17:26 [PATCH] clocksource/drivers/timer-of: check return value of of_iomap in timer_of_base_init() Guillaume Ranquet
2022-03-14  9:28 ` [tip: timers/core] clocksource/drivers/timer-of: Check " tip-bot2 for Guillaume Ranquet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).