* [PATCH] mediatek/clk-mt8173-apmixedsys: use devm_of_iomap to avoid resource leak in clk_mt8173_apmixed_probe
@ 2023-05-09 2:12 Hao Ge
2023-05-10 21:18 ` Stephen Boyd
2023-05-12 0:39 ` Chen-Yu Tsai
0 siblings, 2 replies; 7+ messages in thread
From: Hao Ge @ 2023-05-09 2:12 UTC (permalink / raw)
To: mturquette, sboyd, matthias.bgg, angelogioacchino.delregno, wenst
Cc: gehao618, linux-clk, linux-kernel, linux-arm-kernel,
linux-mediatek, Hao Ge
Use devm_platform_ioremap_resource to take the place of of_iomap for
avoid that we don't called iounmap when return some error or remove
device.
Fixes: 4c02c9af3cb9 ("clk: mediatek: mt8173: Break down clock drivers and allow module build")
Signed-off-by: Hao Ge <gehao@kylinos.cn>
---
drivers/clk/mediatek/clk-mt8173-apmixedsys.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
index 8c2aa8b0f39e..8a2a88c63d15 100644
--- a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
+++ b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
@@ -146,8 +146,8 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev)
struct clk_hw *hw;
int r;
- base = of_iomap(node, 0);
- if (!base)
+ base = devm_of_iomap(&pdev->dev, node, 0, NULL);
+ if (IS_ERR(base))
return PTR_ERR(base);
clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
--
2.25.1
No virus found
Checked by Hillstone Network AntiVirus
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] mediatek/clk-mt8173-apmixedsys: use devm_of_iomap to avoid resource leak in clk_mt8173_apmixed_probe
2023-05-09 2:12 [PATCH] mediatek/clk-mt8173-apmixedsys: use devm_of_iomap to avoid resource leak in clk_mt8173_apmixed_probe Hao Ge
@ 2023-05-10 21:18 ` Stephen Boyd
2023-05-11 1:26 ` Hao Ge
2023-05-12 0:39 ` Chen-Yu Tsai
1 sibling, 1 reply; 7+ messages in thread
From: Stephen Boyd @ 2023-05-10 21:18 UTC (permalink / raw)
To: Hao Ge, angelogioacchino.delregno, matthias.bgg, mturquette, wenst
Cc: gehao618, linux-clk, linux-kernel, linux-arm-kernel,
linux-mediatek, Hao Ge
Quoting Hao Ge (2023-05-08 19:12:14)
> Use devm_platform_ioremap_resource to take the place of of_iomap for
> avoid that we don't called iounmap when return some error or remove
> device.
>
> Fixes: 4c02c9af3cb9 ("clk: mediatek: mt8173: Break down clock drivers and allow module build")
> Signed-off-by: Hao Ge <gehao@kylinos.cn>
> ---
Is this v3?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mediatek/clk-mt8173-apmixedsys: use devm_of_iomap to avoid resource leak in clk_mt8173_apmixed_probe
2023-05-10 21:18 ` Stephen Boyd
@ 2023-05-11 1:26 ` Hao Ge
2023-05-11 22:37 ` Stephen Boyd
0 siblings, 1 reply; 7+ messages in thread
From: Hao Ge @ 2023-05-11 1:26 UTC (permalink / raw)
To: Stephen Boyd
Cc: Hao Ge, angelogioacchino.delregno, matthias.bgg, mturquette,
wenst, linux-clk, linux-kernel, linux-arm-kernel, linux-mediatek
On Wed, 10 May 2023 14:18:08 -0700
Stephen Boyd <sboyd@kernel.org> wrote:
> Quoting Hao Ge (2023-05-08 19:12:14)
> > Use devm_platform_ioremap_resource to take the place of of_iomap for
> > avoid that we don't called iounmap when return some error or remove
> > device.
> >
> > Fixes: 4c02c9af3cb9 ("clk: mediatek: mt8173: Break down clock
> > drivers and allow module build") Signed-off-by: Hao Ge
> > <gehao@kylinos.cn> ---
>
> Is this v3?
Hi Stephen
yes,Perhaps you are too busy,I have not received a response
in the future, so you are unsure about the status of V2.
So I adjusted the code and title make changes smaller and
sent V3 for it.It is precisely because of these that I did
not continue the original mail thread.
Best regards
Hao
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mediatek/clk-mt8173-apmixedsys: use devm_of_iomap to avoid resource leak in clk_mt8173_apmixed_probe
2023-05-11 1:26 ` Hao Ge
@ 2023-05-11 22:37 ` Stephen Boyd
0 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2023-05-11 22:37 UTC (permalink / raw)
To: Hao Ge
Cc: Hao Ge, angelogioacchino.delregno, matthias.bgg, mturquette,
wenst, linux-clk, linux-kernel, linux-arm-kernel, linux-mediatek
Quoting Hao Ge (2023-05-10 18:26:54)
> On Wed, 10 May 2023 14:18:08 -0700
> Stephen Boyd <sboyd@kernel.org> wrote:
>
> > Quoting Hao Ge (2023-05-08 19:12:14)
> > > Use devm_platform_ioremap_resource to take the place of of_iomap for
> > > avoid that we don't called iounmap when return some error or remove
> > > device.
> > >
> > > Fixes: 4c02c9af3cb9 ("clk: mediatek: mt8173: Break down clock
> > > drivers and allow module build") Signed-off-by: Hao Ge
> > > <gehao@kylinos.cn> ---
> >
> > Is this v3?
> Hi Stephen
>
> yes,Perhaps you are too busy,I have not received a response
> in the future, so you are unsure about the status of V2.
> So I adjusted the code and title make changes smaller and
> sent V3 for it.It is precisely because of these that I did
> not continue the original mail thread.
>
I'm waiting for the usual mediatek clk driver folks to review the patch.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mediatek/clk-mt8173-apmixedsys: use devm_of_iomap to avoid resource leak in clk_mt8173_apmixed_probe
2023-05-09 2:12 [PATCH] mediatek/clk-mt8173-apmixedsys: use devm_of_iomap to avoid resource leak in clk_mt8173_apmixed_probe Hao Ge
2023-05-10 21:18 ` Stephen Boyd
@ 2023-05-12 0:39 ` Chen-Yu Tsai
2023-05-15 11:33 ` AngeloGioacchino Del Regno
1 sibling, 1 reply; 7+ messages in thread
From: Chen-Yu Tsai @ 2023-05-12 0:39 UTC (permalink / raw)
To: Hao Ge
Cc: mturquette, sboyd, matthias.bgg, angelogioacchino.delregno,
gehao618, linux-clk, linux-kernel, linux-arm-kernel,
linux-mediatek
On Tue, May 9, 2023 at 11:12 AM Hao Ge <gehao@kylinos.cn> wrote:
>
> Use devm_platform_ioremap_resource to take the place of of_iomap for
> avoid that we don't called iounmap when return some error or remove
> device.
>
> Fixes: 4c02c9af3cb9 ("clk: mediatek: mt8173: Break down clock drivers and allow module build")
> Signed-off-by: Hao Ge <gehao@kylinos.cn>
> ---
> drivers/clk/mediatek/clk-mt8173-apmixedsys.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
> index 8c2aa8b0f39e..8a2a88c63d15 100644
> --- a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
> +++ b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
> @@ -146,8 +146,8 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev)
> struct clk_hw *hw;
> int r;
>
> - base = of_iomap(node, 0);
> - if (!base)
> + base = devm_of_iomap(&pdev->dev, node, 0, NULL);
> + if (IS_ERR(base))
From lib/devres.c:
* Please Note: This is not a one-to-one replacement for of_iomap() because the
* of_iomap() function does not track whether the region is already mapped. If
* two drivers try to map the same memory, the of_iomap() function will succeed
* but the devm_of_iomap() function will return -EBUSY.
The register range for apmixedsys given in mt8173.dtsi overlaps with
the HDMI phy. I'm concerned that would cause issues.
ChenYu
> return PTR_ERR(base);
>
> clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
> --
> 2.25.1
>
>
> No virus found
> Checked by Hillstone Network AntiVirus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mediatek/clk-mt8173-apmixedsys: use devm_of_iomap to avoid resource leak in clk_mt8173_apmixed_probe
2023-05-12 0:39 ` Chen-Yu Tsai
@ 2023-05-15 11:33 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 7+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-05-15 11:33 UTC (permalink / raw)
To: Chen-Yu Tsai, Hao Ge
Cc: mturquette, sboyd, matthias.bgg, gehao618, linux-clk,
linux-kernel, linux-arm-kernel, linux-mediatek
Il 12/05/23 02:39, Chen-Yu Tsai ha scritto:
> On Tue, May 9, 2023 at 11:12 AM Hao Ge <gehao@kylinos.cn> wrote:
>>
>> Use devm_platform_ioremap_resource to take the place of of_iomap for
>> avoid that we don't called iounmap when return some error or remove
>> device.
>>
>> Fixes: 4c02c9af3cb9 ("clk: mediatek: mt8173: Break down clock drivers and allow module build")
>> Signed-off-by: Hao Ge <gehao@kylinos.cn>
>> ---
>> drivers/clk/mediatek/clk-mt8173-apmixedsys.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
>> index 8c2aa8b0f39e..8a2a88c63d15 100644
>> --- a/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
>> +++ b/drivers/clk/mediatek/clk-mt8173-apmixedsys.c
>> @@ -146,8 +146,8 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev)
>> struct clk_hw *hw;
>> int r;
>>
>> - base = of_iomap(node, 0);
>> - if (!base)
>> + base = devm_of_iomap(&pdev->dev, node, 0, NULL);
>> + if (IS_ERR(base))
>
> From lib/devres.c:
>
> * Please Note: This is not a one-to-one replacement for of_iomap() because the
> * of_iomap() function does not track whether the region is already mapped. If
> * two drivers try to map the same memory, the of_iomap() function will succeed
> * but the devm_of_iomap() function will return -EBUSY.
>
> The register range for apmixedsys given in mt8173.dtsi overlaps with
> the HDMI phy. I'm concerned that would cause issues.
I agree, that will cause issues.
Regards,
Angelo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mediatek/clk-mt8173-apmixedsys: use devm_of_iomap to avoid resource leak in clk_mt8173_apmixed_probe
@ 2023-05-11 1:56 Hao Ge
0 siblings, 0 replies; 7+ messages in thread
From: Hao Ge @ 2023-05-11 1:56 UTC (permalink / raw)
To: Stephen Boyd
Cc: Hao Ge, angelogioacchino.delregno, matthias.bgg, mturquette,
wenst, linux-clk, linux-kernel, linux-arm-kernel, linux-mediatek
> On May 11, 2023, at 09:27, Hao Ge <gehao618@163.com> wrote:
>
> On Wed, 10 May 2023 14:18:08 -0700
> Stephen Boyd <sboyd@kernel.org> wrote:
>
>> Quoting Hao Ge (2023-05-08 19:12:14)
>>> Use devm_platform_ioremap_resource to take the place of of_iomap for
>>> avoid that we don't called iounmap when return some error or remove
>>> device.
>>> Fixes: 4c02c9af3cb9 ("clk: mediatek: mt8173: Break down clock
>>> drivers and allow module build") Signed-off-by: Hao Ge
>>> <gehao@kylinos.cn> ---
>> Is this v3?
> Hi Stephen
>
> yes,Perhaps you are too busy,I have not received a response
> in the future, so you are unsure about the status of V2.
> So I adjusted the code and title make changes smaller and
> sent V3 for it.It is precisely because of these that I did
> not continue the original mail thread.
>
> Best regards
> Hao
Hi Stephen
I made a few typos in my previous email. To avoid misunderstandings, I corrected them and sent a new one.
Yes,Perhaps you are too busy,I have not received a response in the future, so I am unsure about the status of V2.So I adjusted the code and title make changes smaller and
sent V3 for it.It is precisely because of these that I did not continue the original mail thread.
Best regards
Hao
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-05-15 11:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-09 2:12 [PATCH] mediatek/clk-mt8173-apmixedsys: use devm_of_iomap to avoid resource leak in clk_mt8173_apmixed_probe Hao Ge
2023-05-10 21:18 ` Stephen Boyd
2023-05-11 1:26 ` Hao Ge
2023-05-11 22:37 ` Stephen Boyd
2023-05-12 0:39 ` Chen-Yu Tsai
2023-05-15 11:33 ` AngeloGioacchino Del Regno
2023-05-11 1:56 Hao Ge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).