From 608cf2b430a77df76a42bd89dceda57a773e6394 Mon Sep 17 00:00:00 2001 From: Liang He Date: Sat, 2 Jul 2022 09:44:49 +0800 Subject: [PATCH] of: device: Fix missing of_node_put() in of_dma_set_restricted_buffer We should use of_node_put() for the reference 'node' returned by of_parse_phandle() which will increase the refcount. Fixes: c06c267f97ed ("of: Add plumbing for restricted DMA pool") Co-authored-by: Miaoqian Lin Signed-off-by: Liang He Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20220702014449.263772-1-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 874f031442dc7..75b6cbffa7558 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.39.5