Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mailbox: zynqmp-ipi-mailbox: Add of_node_put() before goto
@ 2019-07-09 17:28 Nishka Dasgupta
  2019-07-31  8:31 ` Michal Simek
  0 siblings, 1 reply; 6+ messages in thread
From: Nishka Dasgupta @ 2019-07-09 17:28 UTC (permalink / raw)
  To: jassisinghbrar, michal.simek, linux-kernel, linux-arm-kernel
  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/mailbox/zynqmp-ipi-mailbox.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c
index 86887c9a349a..bd80d4c10ec2 100644
--- a/drivers/mailbox/zynqmp-ipi-mailbox.c
+++ b/drivers/mailbox/zynqmp-ipi-mailbox.c
@@ -661,6 +661,7 @@ static int zynqmp_ipi_probe(struct platform_device *pdev)
 		if (ret) {
 			dev_err(dev, "failed to probe subdev.\n");
 			ret = -EINVAL;
+			of_node_put(nc);
 			goto free_mbox_dev;
 		}
 		mbox++;
-- 
2.19.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-08-02  5:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-09 17:28 [PATCH] mailbox: zynqmp-ipi-mailbox: Add of_node_put() before goto Nishka Dasgupta
2019-07-31  8:31 ` Michal Simek
2019-07-31 13:06   ` Nishka Dasgupta
2019-07-31 14:21     ` Michal Simek
2019-08-02  4:59       ` Nishka Dasgupta
2019-08-02  5:12         ` Michal Simek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox