Skip to content

Commit 1eae113

Browse files
tititiou36miquelraynal
authored andcommitted
mtd: rawnand: nuvoton: Fix an error handling path in ma35_nand_chips_init()
If a ma35_nand_chip_init() call fails, then a reference to 'nand_np' still needs to be released. Use for_each_child_of_node_scoped() to fix the issue. Fixes: 5abb5d4 ("mtd: rawnand: nuvoton: add new driver for the Nuvoton MA35 SoC") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent f544bf0 commit 1eae113

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/mtd/nand/raw/nuvoton-ma35d1-nand-controller.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -935,10 +935,10 @@ static void ma35_chips_cleanup(struct ma35_nand_info *nand)
935935

936936
static int ma35_nand_chips_init(struct device *dev, struct ma35_nand_info *nand)
937937
{
938-
struct device_node *np = dev->of_node, *nand_np;
938+
struct device_node *np = dev->of_node;
939939
int ret;
940940

941-
for_each_child_of_node(np, nand_np) {
941+
for_each_child_of_node_scoped(np, nand_np) {
942942
ret = ma35_nand_chip_init(dev, nand, nand_np);
943943
if (ret) {
944944
ma35_chips_cleanup(nand);

0 commit comments

Comments
 (0)