From: Markus Elfring <Markus.Elfring@web.de>
To: Zhen Ni <zhen.ni@easystack.cn>,
linux-clk@vger.kernel.org,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] clk: hisilicon: Fix of_iomap leak in hisi_clk_init
Date: Fri, 1 Aug 2025 17:15:04 +0200 [thread overview]
Message-ID: <2bc87a7e-6616-42cb-ba78-8f037a40ff3c@web.de> (raw)
In-Reply-To: <20250729125729.798897-1-zhen.ni@easystack.cn>
> Smatch reports:
>
> drivers/clk/hisilicon/clk.c:87 hisi_clk_init() warn: 'base'
> from of_iomap() not released on lines: 87.
How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.16#n145
…
> To fix this, iounmap is added when handle error.
See also once more:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.16#n94
…
> +++ b/drivers/clk/hisilicon/clk.c
> @@ -84,6 +84,8 @@ struct hisi_clock_data *hisi_clk_init(struct device_node *np,
> err_data:
> kfree(clk_data);
> err:
> + if (base)
> + iounmap(base);
> return NULL;
> }
…
* Please return directly after a failed of_iomap() call.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.16#n532
* Would it be nicer to use the label “unmap_io”?
* May the statement “clk_data->base = base;” be performed a bit later?
* How do you think about to replace an of_clk_add_provider() call
by of_clk_add_hw_provider()?
https://elixir.bootlin.com/linux/v6.16/source/drivers/clk/clk.c#L4996-L5001
Regards,
Markus
parent reply other threads:[~2025-08-01 15:15 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20250729125729.798897-1-zhen.ni@easystack.cn>]
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=2bc87a7e-6616-42cb-ba78-8f037a40ff3c@web.de \
--to=markus.elfring@web.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
--cc=zhen.ni@easystack.cn \
/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