Skip to content

Commit 4467b8b

Browse files
granquetdlezcano
authored andcommitted
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: 9aea417 ("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>
1 parent 389e3bf commit 4467b8b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/clocksource/timer-of.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ static __init int timer_of_base_init(struct device_node *np,
157157
of_base->base = of_base->name ?
158158
of_io_request_and_map(np, of_base->index, of_base->name) :
159159
of_iomap(np, of_base->index);
160-
if (IS_ERR(of_base->base)) {
161-
pr_err("Failed to iomap (%s)\n", of_base->name);
162-
return PTR_ERR(of_base->base);
160+
if (IS_ERR_OR_NULL(of_base->base)) {
161+
pr_err("Failed to iomap (%s:%s)\n", np->name, of_base->name);
162+
return of_base->base ? PTR_ERR(of_base->base) : -ENOMEM;
163163
}
164164

165165
return 0;

0 commit comments

Comments
 (0)