* [PATCH] drivers/clocksource/qcom: Add missing iounmap() on error when reading clock frequency.
@ 2024-07-10 11:08 Ankit Agrawal
2024-07-10 11:54 ` Konrad Dybcio
0 siblings, 1 reply; 6+ messages in thread
From: Ankit Agrawal @ 2024-07-10 11:08 UTC (permalink / raw)
To: Bjorn Andersson
Cc: Konrad Dybcio, Daniel Lezcano, Thomas Gleixner, linux-arm-msm,
linux-kernel
Add the missing iounmap() when clock frequency fails to get read by the
of_property_read_u32() call.
Signed-off-by: Ankit Agrawal <agrawal.ag.ankit@gmail.com>
---
drivers/clocksource/timer-qcom.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/clocksource/timer-qcom.c b/drivers/clocksource/timer-qcom.c
index b4afe3a67..a66fa7f8e 100644
--- a/drivers/clocksource/timer-qcom.c
+++ b/drivers/clocksource/timer-qcom.c
@@ -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;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] drivers/clocksource/qcom: Add missing iounmap() on error when reading clock frequency.
2024-07-10 11:08 [PATCH] drivers/clocksource/qcom: Add missing iounmap() on error when reading clock frequency Ankit Agrawal
@ 2024-07-10 11:54 ` Konrad Dybcio
2024-07-11 5:49 ` Ankit Agrawal
0 siblings, 1 reply; 6+ messages in thread
From: Konrad Dybcio @ 2024-07-10 11:54 UTC (permalink / raw)
To: Ankit Agrawal, Bjorn Andersson
Cc: Daniel Lezcano, Thomas Gleixner, linux-arm-msm, linux-kernel
On 10.07.2024 1:08 PM, Ankit Agrawal wrote:
> Add the missing iounmap() when clock frequency fails to get read by the
> of_property_read_u32() call.
>
> Signed-off-by: Ankit Agrawal <agrawal.ag.ankit@gmail.com>
> ---
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drivers/clocksource/qcom: Add missing iounmap() on error when reading clock frequency.
2024-07-10 11:54 ` Konrad Dybcio
@ 2024-07-11 5:49 ` Ankit Agrawal
2024-07-11 8:11 ` Konrad Dybcio
0 siblings, 1 reply; 6+ messages in thread
From: Ankit Agrawal @ 2024-07-11 5:49 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Daniel Lezcano, Thomas Gleixner, linux-arm-msm,
linux-kernel
On Wed, Jul 10, 2024 at 01:54:01PM +0200, Konrad Dybcio wrote:
> On 10.07.2024 1:08 PM, Ankit Agrawal wrote:
> > Add the missing iounmap() when clock frequency fails to get read by the
> > of_property_read_u32() call.
> >
> > Signed-off-by: Ankit Agrawal <agrawal.ag.ankit@gmail.com>
> > ---
>
> 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
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drivers/clocksource/qcom: Add missing iounmap() on error when reading clock frequency.
2024-07-11 5:49 ` Ankit Agrawal
@ 2024-07-11 8:11 ` Konrad Dybcio
2024-07-11 8:13 ` Konrad Dybcio
0 siblings, 1 reply; 6+ messages in thread
From: Konrad Dybcio @ 2024-07-11 8:11 UTC (permalink / raw)
To: Ankit Agrawal
Cc: Bjorn Andersson, Daniel Lezcano, Thomas Gleixner, linux-arm-msm,
linux-kernel
On 11.07.2024 7:49 AM, Ankit Agrawal wrote:
> On Wed, Jul 10, 2024 at 01:54:01PM +0200, Konrad Dybcio wrote:
>> On 10.07.2024 1:08 PM, Ankit Agrawal wrote:
>>> Add the missing iounmap() when clock frequency fails to get read by the
>>> of_property_read_u32() call.
>>>
>>> Signed-off-by: Ankit Agrawal <agrawal.ag.ankit@gmail.com>
>>> ---
>>
>> 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
>
> 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!
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
> 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.
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
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Konrad
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drivers/clocksource/qcom: Add missing iounmap() on error when reading clock frequency.
2024-07-11 8:11 ` Konrad Dybcio
@ 2024-07-11 8:13 ` Konrad Dybcio
2024-07-12 8:36 ` Ankit Agrawal
0 siblings, 1 reply; 6+ messages in thread
From: Konrad Dybcio @ 2024-07-11 8:13 UTC (permalink / raw)
To: Ankit Agrawal
Cc: Bjorn Andersson, Daniel Lezcano, Thomas Gleixner, linux-arm-msm,
linux-kernel
On 11.07.2024 10:11 AM, Konrad Dybcio wrote:
> On 11.07.2024 7:49 AM, Ankit Agrawal wrote:
>> On Wed, Jul 10, 2024 at 01:54:01PM +0200, Konrad Dybcio wrote:
>>> On 10.07.2024 1:08 PM, Ankit Agrawal wrote:
[...]
>
> 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
>
> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drivers/clocksource/qcom: Add missing iounmap() on error when reading clock frequency.
2024-07-11 8:13 ` Konrad Dybcio
@ 2024-07-12 8:36 ` Ankit Agrawal
0 siblings, 0 replies; 6+ messages in thread
From: Ankit Agrawal @ 2024-07-12 8:36 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Daniel Lezcano, Thomas Gleixner, linux-arm-msm,
linux-kernel
On Thu, Jul 11, 2024 at 10:13:38AM +0200, Konrad Dybcio wrote:
> On 11.07.2024 10:11 AM, Konrad Dybcio wrote:
> > On 11.07.2024 7:49 AM, Ankit Agrawal wrote:
> >> On Wed, Jul 10, 2024 at 01:54:01PM +0200, Konrad Dybcio wrote:
> >>> On 10.07.2024 1:08 PM, Ankit Agrawal wrote:
[...]
>
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-07-12 8:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-10 11:08 [PATCH] drivers/clocksource/qcom: Add missing iounmap() on error when reading clock frequency Ankit Agrawal
2024-07-10 11:54 ` Konrad Dybcio
2024-07-11 5:49 ` Ankit Agrawal
2024-07-11 8:11 ` Konrad Dybcio
2024-07-11 8:13 ` Konrad Dybcio
2024-07-12 8:36 ` Ankit Agrawal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox