Patch "clk: imx: clk-imx8mn: fix memory leak in imx8mn_clocks_probe" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    clk: imx: clk-imx8mn: fix memory leak in imx8mn_clocks_probe

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     clk-imx-clk-imx8mn-fix-memory-leak-in-imx8mn_clocks_.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f9371c4cabe17c1c524bd51232af263571b9b13d
Author: Hao Luo <m202171776@xxxxxxxxxxx>
Date:   Tue Apr 11 09:51:07 2023 +0800

    clk: imx: clk-imx8mn: fix memory leak in imx8mn_clocks_probe
    
    [ Upstream commit 188d070de9132667956f5aadd98d2bd87d3eac89 ]
    
    Use devm_of_iomap() instead of of_iomap() to automatically handle
    the unused ioremap region.
    
    If any error occurs, regions allocated by kzalloc() will leak,
    but using devm_kzalloc() instead will automatically free the memory
    using devm_kfree().
    
    Fixes: daeb14545514 ("clk: imx: imx8mn: Switch to clk_hw based API")
    Fixes: 96d6392b54db ("clk: imx: Add support for i.MX8MN clock driver")
    Signed-off-by: Hao Luo <m202171776@xxxxxxxxxxx>
    Reviewed-by: Dongliang Mu <dzm91@xxxxxxxxxxx>
    Reviewed-by: Peng Fan <peng.fan@xxxxxxx>
    Link: https://lore.kernel.org/r/20230411015107.2645-1-m202171776@xxxxxxxxxxx
    Signed-off-by: Abel Vesa <abel.vesa@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c
index 52903146fdbaf..4499da4154f06 100644
--- a/drivers/clk/imx/clk-imx8mn.c
+++ b/drivers/clk/imx/clk-imx8mn.c
@@ -299,7 +299,7 @@ static int imx8mn_clocks_probe(struct platform_device *pdev)
 	void __iomem *base;
 	int ret;
 
-	clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
+	clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws,
 					  IMX8MN_CLK_END), GFP_KERNEL);
 	if (WARN_ON(!clk_hw_data))
 		return -ENOMEM;
@@ -316,10 +316,10 @@ static int imx8mn_clocks_probe(struct platform_device *pdev)
 	hws[IMX8MN_CLK_EXT4] = imx_obtain_fixed_clk_hw(np, "clk_ext4");
 
 	np = of_find_compatible_node(NULL, NULL, "fsl,imx8mn-anatop");
-	base = of_iomap(np, 0);
+	base = devm_of_iomap(dev, np, 0, NULL);
 	of_node_put(np);
-	if (WARN_ON(!base)) {
-		ret = -ENOMEM;
+	if (WARN_ON(IS_ERR(base))) {
+		ret = PTR_ERR(base);
 		goto unregister_hws;
 	}
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux