drivers/clocksource/qcom: Add missing iounmap() on error when reading clock frequency.
Subsystems (2)
PATCH 1/1 drivers/clocksource/qcom: Add missing iounmap() on error when reading clock frequency.
Add the missing iounmap() when clock frequency fails to get read by the of_property_read_u32() call.
--- drivers/clocksource/timer-qcom.c | 1 + 1 file changed, 1 insertion(+)
drivers/clocksource/timer-qcom.c +1 -0
@@ -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 ; }
Signature · 1 line
2.25.1
Quoted 5 lines · Ankit Agrawal
Add the missing
iounmap()when clock frequency fails to get read by theof_property_read_u32()call.Signed-off-by Ankit Agrawal <[email protected]>---
Or even better, you can extract:
drivers/platform/x86/intel/pmc/core_ssram.c 32:DEFINE_FREE(pmc_core_iounmap, void __iomem *, iounmap(_T));
into a common header, call it something less intel-specific and use it with __free() here
Konrad
Quoted 7 lines · Konrad Dybcio
Quoted 5 lines · Ankit Agrawal
Add the missing
iounmap()when clock frequency fails to get read by theof_property_read_u32()call.Signed-off-by Ankit Agrawal <[email protected]>---
Quoted 7 lines
Or even better, you can extract:
drivers/platform/x86/intel/pmc/core_ssram.c32:DEFINE_FREE(pmc_core_iounmap, void__iomem*,iounmap(_T));into a common header, call it something less intel-specific and use it with
__free()here
Can you please give a place where adding it would be appropriate? I am new to contributing here, so any guidance on where to add the DEFINE_FREE would be really helpful!
Also, just trying to think out loud. Will the cpu0_base pointer (and also the source_base pointer) be required once this function exits? If so, I think I will also need to use no_free_ptr() to ensure that the memory doesn't get iounmap-ed once the function exits.
Thanks!
Ankit
Konrad Dybcio
Reviewed-byQuoted 13 lines · Ankit Agrawal
Quoted 12 lines · Konrad Dybcio
Quoted 5 lines · Ankit Agrawal
Add the missing
iounmap()when clock frequency fails to get read by theof_property_read_u32()call.Signed-off-by Ankit Agrawal <[email protected]>---
Or even better, you can extract:
drivers/platform/x86/intel/pmc/core_ssram.c32:DEFINE_FREE(pmc_core_iounmap, void__iomem*,iounmap(_T));
Quoted 6 lines
Quoted 2 lines
into a common header, call it something less intel-specific and use it with
__free()hereCan you please give a place where adding it would be appropriate? I am new to contributing here, so any guidance on where to add the
DEFINE_FREEwould be really helpful!
I'd say include/linux/io.h sounds alright, but worst case scenario the maintainer of that file will ask you to move it somewhere else
Quoted 4 lines
Also, just trying to think out loud. Will the
cpu0_basepointer (and also thesource_basepointer) be required once this function exits? If so, I think I will also need to useno_free_ptr()to ensure that the memory doesn't get iounmap-ed once the function exits.
Ohh right source_base is a global variable.. perhaps the original patch here makes more sense given we definitely don't wanna unmap that..
So I'd say let's go with this one after all
Konrad
Quoted 3 lines · Konrad Dybcio
Quoted 2 lines · Ankit Agrawal
Quoted 1 line · Konrad Dybcio
On 10.07.2024 1:08 PM, Ankit Agrawal wrote:
[...]
Quoted 7 lines
Ohh right
source_baseis a global variable.. perhaps the original patch here makes more sense given we definitely don't wanna unmap that..So I'd say let's go with this one after all
Reviewed-by Konrad Dybcio <[email protected]>
We should probably also check if msm_timer_init() succeeds and unmap if that fails.. we can just check the return value of that function and if it's non-zero, call iounmap
Konrad
Quoted 4 lines · Konrad Dybcio
Quoted 3 lines · Konrad Dybcio
Quoted 2 lines · Ankit Agrawal
Quoted 1 line · Konrad Dybcio
On 10.07.2024 1:08 PM, Ankit Agrawal wrote:
[...]
Quoted 4 lines
We should probably also check if
msm_timer_init()succeeds and unmap if that fails.. we can just check the return value of that function and if it's non-zero, call iounmap
Sure. I have updated the patch accordingly. Please find version 2 of the patch here: https://lore.kernel.org/linux-arm-msm/20240712082747.GA182658@bnew-VirtualBox/
Thanks!
Ankit