]> git.baikalelectronics.ru Git - kernel.git/commitdiff
of: device: Fix missing of_node_put() in of_dma_set_restricted_buffer
authorLiang He <windhl@126.com>
Sat, 2 Jul 2022 01:44:49 +0000 (09:44 +0800)
committerRob Herring <robh@kernel.org>
Tue, 12 Jul 2022 16:58:33 +0000 (10:58 -0600)
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 <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
drivers/of/device.c

index 874f031442dc7bf1a631315591f7917deb3222f0..75b6cbffa7558bf91cf4a545dc9119dc0dfb5551 100644 (file)
@@ -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);
        }
 
        /*