summaryrefslogtreecommitdiff
path: root/drivers/of
diff options
context:
space:
mode:
authorLiang He <windhl@126.com>2022-07-02 04:44:49 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-08-17 16:15:31 +0300
commitdfca1e217298ca5cdc4aba9c0ac49e8d3e2bf776 (patch)
tree5822fc221c92784e484dc22b4d6c14098b0cc487 /drivers/of
parent98b2ddfa9471e6bf19054e6541cb3118ee94361a (diff)
downloadlinux-dfca1e217298ca5cdc4aba9c0ac49e8d3e2bf776.tar.xz
of: device: Fix missing of_node_put() in of_dma_set_restricted_buffer
[ Upstream commit d17e37c41b7ed38459957a5d2968ba61516fd5c2 ] 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> Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20220702014449.263772-1-windhl@126.com Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/device.c5
1 files changed, 4 insertions, 1 deletions
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);
}
/*