[PATCH RFC] clocksource: dbx500-prcmu: check timer register mapping

Slavin Liu posted 1 patch 2 weeks ago
drivers/clocksource/clksrc-dbx500-prcmu.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH RFC] clocksource: dbx500-prcmu: check timer register mapping
Posted by Slavin Liu 2 weeks ago
Return -ENOMEM if of_iomap() fails, before reading or configuring
the timer register block.

Detected by static analysis and reviewed with AI-assisted source auditing.

Fixes: 9d2aa8c7961a ("ARM/clocksource: use automatic DT probing for ux500 PRCMU")
Assisted-by: LLM
Signed-off-by: Slavin Liu <bolin.liu@seu.edu.cn>
---
 drivers/clocksource/clksrc-dbx500-prcmu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clocksource/clksrc-dbx500-prcmu.c b/drivers/clocksource/clksrc-dbx500-prcmu.c
index 2fc93e46cea3..1af223b0e896 100644
--- a/drivers/clocksource/clksrc-dbx500-prcmu.c
+++ b/drivers/clocksource/clksrc-dbx500-prcmu.c
@@ -52,6 +52,8 @@ static struct clocksource clocksource_dbx500_prcmu = {
 static int __init clksrc_dbx500_prcmu_init(struct device_node *node)
 {
 	clksrc_dbx500_timer_base = of_iomap(node, 0);
+	if (!clksrc_dbx500_timer_base)
+		return -ENOMEM;
 
 	/*
 	 * The A9 sub system expects the timer to be configured as
Re: [PATCH RFC] clocksource: dbx500-prcmu: check timer register mapping
Posted by Linus Walleij 1 week, 1 day ago
On Fri, Sep 11, 2026 at 8:09 AM Slavin Liu <bolin.liu@seu.edu.cn> wrote:

> Return -ENOMEM if of_iomap() fails, before reading or configuring
> the timer register block.
>
> Detected by static analysis and reviewed with AI-assisted source auditing.
>
> Fixes: 9d2aa8c7961a ("ARM/clocksource: use automatic DT probing for ux500 PRCMU")
> Assisted-by: LLM
> Signed-off-by: Slavin Liu <bolin.liu@seu.edu.cn>

Reviewed-by: Linus Walleij <linusw@kernel.org>

Yours,
Linus Walleij