public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
To: Chen-Yu Tsai <wenst@chromium.org>, Hao Ge <gehao@kylinos.cn>
Cc: mturquette@baylibre.com, sboyd@kernel.org,
	matthias.bgg@gmail.com, gehao618@163.com,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] mediatek/clk-mt8173-apmixedsys: use devm_of_iomap to avoid resource leak in clk_mt8173_apmixed_probe
Date: Mon, 15 May 2023 13:33:45 +0200	[thread overview]
Message-ID: <8a3249a5-787b-5c7d-cf7c-69b732eb100e@collabora.com> (raw)
In-Reply-To: <CAGXv+5Gvw0QsOa-7E==61WUiJ-q=9qAqN9E0L9hsmk+t12RJ9A@mail.gmail.com>

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


  reply	other threads:[~2023-05-15 11:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-05-11  1:56 Hao Ge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8a3249a5-787b-5c7d-cf7c-69b732eb100e@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=gehao618@163.com \
    --cc=gehao@kylinos.cn \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=wenst@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox