diff options
author | Nishka Dasgupta <nishkadg.linux@gmail.com> | 2019-07-09 22:43:16 +0530 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2019-07-25 14:21:44 +0200 |
commit | a08e42987118952c98707f0b29cf0e5f4fd2e00b (patch) | |
tree | 157237101395a25b9b785c2cf5efa7883219a2e2 | |
parent | c436f68beeb20f2f92937677db1d9069b0dd2a3d (diff) |
mtd: rawnand: tango: Add of_node_put() before return
Each iteration of for_each_child_of_node puts the previous node, but in
the case of a return from the middle of the loop, there is no put, thus
causing a memory leak. Hence add an of_node_put before the return.
Issue found with Coccinelle.
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Acked-by: Mans Rullgard <mans@mansr.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-rw-r--r-- | drivers/mtd/nand/raw/tango_nand.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/mtd/nand/raw/tango_nand.c b/drivers/mtd/nand/raw/tango_nand.c index b3f2cabcc7c0..9acf2de37ee0 100644 --- a/drivers/mtd/nand/raw/tango_nand.c +++ b/drivers/mtd/nand/raw/tango_nand.c @@ -659,6 +659,7 @@ static int tango_nand_probe(struct platform_device *pdev) err = chip_init(&pdev->dev, np); if (err) { tango_nand_remove(pdev); + of_node_put(np); return err; } } |