Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 6e3321631ac2 ("ARM: msm: Add DT support to msm_timer")
Signed-off-by: Ankit Agrawal <agrawal.ag.ankit@gmail.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20240713095713.GA430091@bnew-VirtualBox
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

authored by

Ankit Agrawal and committed by
Daniel Lezcano
ca140a0d 414b2fb4

+6 -1
+6 -1
drivers/clocksource/timer-qcom.c
··· 233 233 } 234 234 235 235 if (of_property_read_u32(np, "clock-frequency", &freq)) { 236 + iounmap(cpu0_base); 236 237 pr_err("Unknown frequency\n"); 237 238 return -EINVAL; 238 239 } ··· 244 243 freq /= 4; 245 244 writel_relaxed(DGT_CLK_CTL_DIV_4, source_base + DGT_CLK_CTL); 246 245 247 - return msm_timer_init(freq, 32, irq, !!percpu_offset); 246 + ret = msm_timer_init(freq, 32, irq, !!percpu_offset); 247 + if (ret) 248 + iounmap(cpu0_base); 249 + 250 + return ret; 248 251 } 249 252 TIMER_OF_DECLARE(kpss_timer, "qcom,kpss-timer", msm_dt_timer_init); 250 253 TIMER_OF_DECLARE(scss_timer, "qcom,scss-timer", msm_dt_timer_init);