]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mtd: rawnand: atmel: Fix error handling path in atmel_nand_controller_add_nands
authorErick Karanja <karanja99erick@gmail.com>
Mon, 22 Sep 2025 11:07:27 +0000 (14:07 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Oct 2025 09:56:38 +0000 (11:56 +0200)
commitc893b0112070bd7073acb6fbca787447c37298d5
treed28b7864fc05b37fe323667c65e4b0e5725730e8
parent63459564661044c07378c0a63e34dc58faff4bba
mtd: rawnand: atmel: Fix error handling path in atmel_nand_controller_add_nands

[ Upstream commit 8ed4728eb9f10b57c3eb02e0f6933a89ffcb8a91 ]

In case of a jump to the  err label due to atmel_nand_create() or
atmel_nand_controller_add_nand() failure, the reference to nand_np
need to be released

Use for_each_child_of_node_scoped() to fix the issue.

Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
Signed-off-by: Erick Karanja <karanja99erick@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mtd/nand/raw/atmel/nand-controller.c