* [PATCH] mtd: rawnand: vf610_nfc: Add of_node_put() before goto
@ 2019-07-09 17:08 Nishka Dasgupta
2019-07-09 18:54 ` Stefan Agner
2019-07-25 7:55 ` Miquel Raynal
0 siblings, 2 replies; 3+ messages in thread
From: Nishka Dasgupta @ 2019-07-09 17:08 UTC (permalink / raw)
To: stefan, miquel.raynal, richard, dwmw2, computersforpeace,
marek.vasut, vigneshr, linux-mtd
Cc: Nishka Dasgupta
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>
---
drivers/mtd/nand/raw/vf610_nfc.c | 1 +
1 file changed, 1 insertion(+)
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;
}
--
2.19.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: rawnand: vf610_nfc: Add of_node_put() before goto
2019-07-09 17:08 [PATCH] mtd: rawnand: vf610_nfc: Add of_node_put() before goto Nishka Dasgupta
@ 2019-07-09 18:54 ` Stefan Agner
2019-07-25 7:55 ` Miquel Raynal
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Agner @ 2019-07-09 18:54 UTC (permalink / raw)
To: Nishka Dasgupta
Cc: vigneshr, richard, marek.vasut, linux-mtd, miquel.raynal,
computersforpeace, dwmw2
On 2019-07-09 19:08, Nishka Dasgupta wrote:
> 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>
Looks good to me:
Reviewed-by: Stefan Agner <stefan@agner.ch>
--
Stefan
> ---
> drivers/mtd/nand/raw/vf610_nfc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> 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;
> }
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: rawnand: vf610_nfc: Add of_node_put() before goto
2019-07-09 17:08 [PATCH] mtd: rawnand: vf610_nfc: Add of_node_put() before goto Nishka Dasgupta
2019-07-09 18:54 ` Stefan Agner
@ 2019-07-25 7:55 ` Miquel Raynal
1 sibling, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2019-07-25 7:55 UTC (permalink / raw)
To: Nishka Dasgupta, stefan, miquel.raynal, richard, dwmw2,
computersforpeace, marek.vasut, vigneshr, linux-mtd
On Tue, 2019-07-09 at 17:08:37 UTC, Nishka Dasgupta wrote:
> 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>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-25 7:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-09 17:08 [PATCH] mtd: rawnand: vf610_nfc: Add of_node_put() before goto Nishka Dasgupta
2019-07-09 18:54 ` Stefan Agner
2019-07-25 7:55 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).