summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
authorNishka Dasgupta <nishkadg.linux@gmail.com>2019-07-09 19:08:37 +0200
committerMiquel Raynal <miquel.raynal@bootlin.com>2019-07-25 14:21:44 +0200
commit4902e87faf26067d661e2a9285ce93457884da6d (patch)
treeefab587b69e0496f529830ab81bdd6255f51cac1 /drivers/mtd/nand
parentmtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option (diff)
downloadlinux-4902e87faf26067d661e2a9285ce93457884da6d.tar.xz
linux-4902e87faf26067d661e2a9285ce93457884da6d.zip
mtd: rawnand: vf610: Add of_node_put() before goto
Each iteration of for_each_available_child_of_node puts the previous node, but in the case of a goto from the middle of the loop, there is no put, thus causing a memory leak. Hence add an of_node_put before the goto. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Reviewed-by: Stefan Agner <stefan@agner.ch> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/raw/vf610_nfc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_nfc.c
index e4fe8c4bc711..6b399a75f9ae 100644
--- a/drivers/mtd/nand/raw/vf610_nfc.c
+++ b/drivers/mtd/nand/raw/vf610_nfc.c
@@ -862,6 +862,7 @@ static int vf610_nfc_probe(struct platform_device *pdev)
dev_err(nfc->dev,
"Only one NAND chip supported!\n");
err = -EINVAL;
+ of_node_put(child);
goto err_disable_clk;
}