From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Adam Ford <aford173@gmail.com>, linux-clk@vger.kernel.org
Cc: Aisheng Dong <aisheng.dong@nxp.com>,
Linus Walleij <linus.walleij@linaro.org>,
Abel Vesa <abel.vesa@nxp.com>, Stephen Boyd <sboyd@kernel.org>,
Fabio Estevam <festevam@gmail.com>,
Michael Turquette <mturquette@baylibre.com>,
aford@beaconembedded.com, linux-kernel@vger.kernel.org,
NXP Linux Team <linux-imx@nxp.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
linux-arm-kernel@lists.infradead.org,
Jerome Brunet <jbrunet@baylibre.com>
Subject: Re: [PATCH V4] clk: imx: Fix reparenting of UARTs not associated with stdout
Date: Sun, 14 Mar 2021 10:40:24 +0100 [thread overview]
Message-ID: <0361ab5b-a26e-7631-9bae-8909715f6354@pengutronix.de> (raw)
In-Reply-To: <e754a185-4aa2-295a-37a8-dd0c7ebc289f@pengutronix.de>
On 13.03.21 16:16, Ahmad Fatoum wrote:
>> +/* i.MX boards use device trees now. For build tests without CONFIG_OF, do nothing */
>> +#ifdef CONFIG_OF
>> if (imx_keep_uart_clocks) {
>> int i;
>>
>> - imx_uart_clocks = clks;
>> - for (i = 0; imx_uart_clocks[i]; i++)
>> - clk_prepare_enable(*imx_uart_clocks[i]);
>> + imx_uart_clocks = kcalloc(clk_count, sizeof(struct clk *), GFP_KERNEL);
>> +
>> + if (!of_stdout)
>> + return;
>
> Memory leak. Just do if (imx_keep_uart_clocks && of_stdout)
Please dismiss. I overlooked that you free it in a later initcall.
>> static int __init imx_clk_disable_uart(void)
>> {
>> - if (imx_keep_uart_clocks && imx_uart_clocks) {
>> + if (imx_keep_uart_clocks && imx_enabled_uart_clocks) {
>> int i;
>>
>> - for (i = 0; imx_uart_clocks[i]; i++)
>> - clk_disable_unprepare(*imx_uart_clocks[i]);
>> + for (i = 0; i < imx_enabled_uart_clocks; i++) {
>> + clk_disable_unprepare(imx_uart_clocks[i]);
>> + clk_put(imx_uart_clocks[i]);
>> + };
>> + kfree(imx_uart_clocks);
>> }
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-03-14 9:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-13 12:28 [PATCH V4] clk: imx: Fix reparenting of UARTs not associated with stdout Adam Ford
2021-03-13 15:16 ` Ahmad Fatoum
2021-03-14 9:40 ` Ahmad Fatoum [this message]
2021-03-20 23:00 ` Adam Ford
2021-03-22 11:05 ` Abel Vesa
2021-03-22 21:42 ` Abel Vesa
2021-03-24 17:06 ` Adam Ford
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=0361ab5b-a26e-7631-9bae-8909715f6354@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=abel.vesa@nxp.com \
--cc=aford173@gmail.com \
--cc=aford@beaconembedded.com \
--cc=aisheng.dong@nxp.com \
--cc=festevam@gmail.com \
--cc=jbrunet@baylibre.com \
--cc=kernel@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=s.hauer@pengutronix.de \
--cc=sboyd@kernel.org \
--cc=shawnguo@kernel.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;
as well as URLs for NNTP newsgroup(s).