mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-06 09:25:22 +02:00
mtd: rawnand: mtk: Fix init error path
[ Upstream commit2073ae37d5
] Reviewing a series converting the for_each_chil_of_node() loops into their _scoped variants made me realize there was no cleanup of the already registered NAND devices upon error which may leak memory on systems with more than a chip when this error occurs. We should call the _nand_chips_cleanup() function when this happens. Fixes:1d6b1e4649
("mtd: mediatek: driver for MTK Smart Device") Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Pratyush Yadav <pratyush@kernel.org> Reviewed-by: Matthias Brugger <matthias.bgg@kernel.org> Link: https://lore.kernel.org/linux-mtd/20240826153019.67106-2-miquel.raynal@bootlin.com Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
e502a0db34
commit
0f0222d5ab
|
@ -1453,8 +1453,10 @@ static int mtk_nfc_nand_chips_init(struct device *dev, struct mtk_nfc *nfc)
|
|||
|
||||
for_each_child_of_node_scoped(np, nand_np) {
|
||||
ret = mtk_nfc_nand_chip_init(dev, nfc, nand_np);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
mtk_nfc_nand_chips_cleanup(nfc);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user