Skip to content

Commit ca140a0

Browse files
Ankit Agrawaldlezcano
authored andcommitted
clocksource/drivers/qcom: Add missing iounmap() on errors in msm_dt_timer_init()
Add the missing iounmap() when clock frequency fails to get read by the of_property_read_u32() call, or if the call to msm_timer_init() fails. Fixes: 6e33216 ("ARM: msm: Add DT support to msm_timer") Signed-off-by: Ankit Agrawal <[email protected]> Reviewed-by: Konrad Dybcio <[email protected]> Link: https://lore.kernel.org/r/20240713095713.GA430091@bnew-VirtualBox Signed-off-by: Daniel Lezcano <[email protected]>
1 parent 414b2fb commit ca140a0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/clocksource/timer-qcom.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ static int __init msm_dt_timer_init(struct device_node *np)
233233
}
234234

235235
if (of_property_read_u32(np, "clock-frequency", &freq)) {
236+
iounmap(cpu0_base);
236237
pr_err("Unknown frequency\n");
237238
return -EINVAL;
238239
}
@@ -243,7 +244,11 @@ static int __init msm_dt_timer_init(struct device_node *np)
243244
freq /= 4;
244245
writel_relaxed(DGT_CLK_CTL_DIV_4, source_base + DGT_CLK_CTL);
245246

246-
return msm_timer_init(freq, 32, irq, !!percpu_offset);
247+
ret = msm_timer_init(freq, 32, irq, !!percpu_offset);
248+
if (ret)
249+
iounmap(cpu0_base);
250+
251+
return ret;
247252
}
248253
TIMER_OF_DECLARE(kpss_timer, "qcom,kpss-timer", msm_dt_timer_init);
249254
TIMER_OF_DECLARE(scss_timer, "qcom,scss-timer", msm_dt_timer_init);

0 commit comments

Comments
 (0)