Skip to contentSkip to conversation

drivers/clocksource/qcom: Add missing iounmap() on errors in msm_dt_timer_init() function.

PATCH Superseded Ankit Agrawal 2 participants 5 messages Jul 12, 2024

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drivers/clocksource/qcom: Add missing iounmap() on errors in msm_dt_timer_init() function.

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.

---
Changes in v2:
- Add iounmap() if msm_timer_init() fails
- Update patch commit message

Previous discussion here:
[1] v1: https://lore.kernel.org/linux-arm-msm/20240710110813.GA15351@bnew-VirtualBox/

---
 drivers/clocksource/timer-qcom.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/clocksource/timer-qcom.c +6 -1
index b4afe3a67..eac4c95c6 100644
@@ -233,6 +233,7 @@ static int __init msm_dt_timer_init(struct device_node *np)
 	}
 
 	if (of_property_read_u32(np, "clock-frequency", &freq)) {
+		iounmap(cpu0_base);
 		pr_err("Unknown frequency\n");
 		return -EINVAL;
 	}
@@ -243,7 +244,11 @@ static int __init msm_dt_timer_init(struct device_node *np)
 	freq /= 4;
 	writel_relaxed(DGT_CLK_CTL_DIV_4, source_base + DGT_CLK_CTL);
 
-	return msm_timer_init(freq, 32, irq, !!percpu_offset);
+	ret = msm_timer_init(freq, 32, irq, !!percpu_offset);
+	if (ret)
+		iounmap(cpu0_base);
+
+	return ret;
 }
 TIMER_OF_DECLARE(kpss_timer, "qcom,kpss-timer", msm_dt_timer_init);
 TIMER_OF_DECLARE(scss_timer, "qcom,scss-timer", msm_dt_timer_init);
Signature · 1 line
2.25.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · Ankit Agrawal

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.

---

For your future submissions: run:

/scripts/checkpatch.pl -g $(git describe --abbrev=0)..

to run some static checks, such as "title is rather long"

..but I don't mind!

Konrad

#2 lore raw
Quoted 9 lines · Konrad Dybcio
Quoted 5 lines · Ankit Agrawal

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.

---

For your future submissions: run:

Quoted 8 lines

/scripts/checkpatch.pl -g $(git describe --abbrev=0)..

to run some static checks, such as "title is rather long"

..but I don't mind!

Also:

Fixes 6e3321631ac2 ("ARM: msm: Add DT support to msm_timer")

Konrad

#3 lore raw
Quoted 2 lines · Konrad Dybcio
Quoted 1 line · Konrad Dybcio

On 12.07.2024 10:27 AM, Ankit Agrawal wrote:

[...]

Quoted 4 lines

Also:

Fixes 6e3321631ac2 ("ARM: msm: Add DT support to msm_timer")

Thank you for pointing this out. I will send a patch v3 to take care of this. Also, I will use this opportunity to shorten out the title a bit.

Thanks!
Ankit

#4 lore raw
In reply to Konrad Dybcio
Quoted 4 lines · Konrad Dybcio
Quoted 3 lines · Ankit Agrawal

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.

Quoted 8 lines
Quoted 2 lines

---

For your future submissions: run:

/scripts/checkpatch.pl -g $(git describe --abbrev=0)..

to run some static checks, such as "title is rather long"

Sure, noted.

Thanks!
Ankit