mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-17 06:39:37 +02:00
mtd: rawnand: mtk: Use for_each_child_of_node_scoped()
[ Upstream commit8795952679
] Avoids the need for manual cleanup of_node_put() in early exits from the loop. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20240826094328.2991664-8-ruanjinjie@huawei.com Stable-dep-of:2073ae37d5
("mtd: rawnand: mtk: Fix init error path") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
9b52ee18f6
commit
ca63b1cbcd
|
@ -1432,15 +1432,12 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc,
|
|||
static int mtk_nfc_nand_chips_init(struct device *dev, struct mtk_nfc *nfc)
|
||||
{
|
||||
struct device_node *np = dev->of_node;
|
||||
struct device_node *nand_np;
|
||||
int ret;
|
||||
|
||||
for_each_child_of_node(np, nand_np) {
|
||||
for_each_child_of_node_scoped(np, nand_np) {
|
||||
ret = mtk_nfc_nand_chip_init(dev, nfc, nand_np);
|
||||
if (ret) {
|
||||
of_node_put(nand_np);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user