summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Ranquet <granquet@baylibre.com>2022-03-07 20:26:56 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-15 15:14:43 +0300
commitb9d22a8fc6cfd5f29ea19cbf1d60aa9cee6df6f3 (patch)
tree79a2997fb9f82a668a70096b26b5274ff89792f9
parentc1204628ae361945c18662aeeeb5d09ec0ceb1de (diff)
downloadlinux-b9d22a8fc6cfd5f29ea19cbf1d60aa9cee6df6f3.tar.xz
clocksource/drivers/timer-of: Check return value of of_iomap in timer_of_base_init()
[ Upstream commit 4467b8bad2401794fb89a0268c8c8257180bf60f ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/clocksource/timer-of.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/clocksource/timer-of.c b/drivers/clocksource/timer-of.c
index 6e2cb3693ed8..82bb0d39e8af 100644
--- a/drivers/clocksource/timer-of.c
+++ b/drivers/clocksource/timer-of.c
@@ -164,9 +164,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;