[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8a3249a5-787b-5c7d-cf7c-69b732eb100e@collabora.com>
Date: Mon, 15 May 2023 13:33:45 +0200
From: AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
To: Chen-Yu Tsai <wenst@...omium.org>, Hao Ge <gehao@...inos.cn>
Cc: mturquette@...libre.com, sboyd@...nel.org, matthias.bgg@...il.com,
gehao618@....com, linux-clk@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH] mediatek/clk-mt8173-apmixedsys: use devm_of_iomap to
avoid resource leak in clk_mt8173_apmixed_probe
Il 12/05/23 02:39, Chen-Yu Tsai ha scritto:
> On Tue, May 9, 2023 at 11:12 AM Hao Ge <gehao@...inos.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@...inos.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
Powered by blists - more mailing lists