[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <dc0f2863-d5d5-5102-eb8e-ceea92c03fda@oss.nxp.com>
Date: Fri, 28 Apr 2023 15:50:16 +0800
From: Peng Fan <peng.fan@....nxp.com>
To: Zhou Shide <u201911681@...t.edu.cn>,
Abel Vesa <abelvesa@...nel.org>, Peng Fan <peng.fan@....com>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
NXP Linux Team <linux-imx@....com>,
Bai Ping <ping.bai@....com>
Cc: hust-os-kernel-patches@...glegroups.com, linux-clk@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] clk: imx: clk-imx8mm: fix memory leak issue in
'imx8mm_clocks_probe'
On 4/13/2023 11:24 AM, Zhou Shide wrote:
> The function imx8mm_clocks_probe() has two main issues:
> - The of_iomap() function may cause a memory leak.
> - Memory allocated for 'clk_hw_data' may not be freed properly
> in some paths.
>
> To fix these issues, this commit replaces the use of of_iomap()
> with devm_of_iomap() and replaces kzalloc() with devm_kzalloc().
> This ensures that all memory is properly managed and automatically
> freed when the device is removed.
>
> In addition, when devm_of_iomap() allocates memory with an error,
> it will first jump to label "unregister_hws" and
> then return PTR_ ERR(base).
>
> Fixes: 9c71f9ea35d7 ("clk: imx: imx8mm: Switch to clk_hw based API")
> Fixes: ba5625c3e272 ("clk: imx: Add clock driver support for imx8mm")
> Signed-off-by: Zhou Shide<u201911681@...t.edu.cn>
Reviewed-by: Peng Fan <peng.fan@....com>
Powered by blists - more mailing lists