devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: device: Fix missing of_node_put() in of_dma_set_restricted_buffer
@ 2022-07-02  1:44 Liang He
  2022-07-05 14:45 ` Rob Herring
  0 siblings, 1 reply; 5+ messages in thread
From: Liang He @ 2022-07-02  1:44 UTC (permalink / raw)
  To: robh+dt, frowand.list, devicetree, windhl, linmq006

We should use of_node_put() for the reference 'node' returned by
of_parse_phandle() which will increase the refcount.

Fixes: fec9b625095f ("of: Add plumbing for restricted DMA pool")
Co-authored-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Liang He <windhl@126.com>
---
 drivers/of/device.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/of/device.c b/drivers/of/device.c
index 874f031442dc..75b6cbffa755 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -81,8 +81,11 @@ of_dma_set_restricted_buffer(struct device *dev, struct device_node *np)
 		 * restricted-dma-pool region is allowed.
 		 */
 		if (of_device_is_compatible(node, "restricted-dma-pool") &&
-		    of_device_is_available(node))
+		    of_device_is_available(node)) {
+			of_node_put(node);
 			break;
+		}
+		of_node_put(node);
 	}
 
 	/*
-- 
2.25.1


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

end of thread, other threads:[~2022-07-12 16:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-02  1:44 [PATCH] of: device: Fix missing of_node_put() in of_dma_set_restricted_buffer Liang He
2022-07-05 14:45 ` Rob Herring
2022-07-06  1:14   ` Liang He
2022-07-06  7:33   ` Liang He
2022-07-12 16:58     ` Rob Herring

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).