]> git.itanic.dy.fi Git - linux-stable/commitdiff
powerpc/pseries: Add missing of_node_put() in ibmebus
authorLiang He <windhl@126.com>
Sun, 19 Jun 2022 07:40:16 +0000 (15:40 +0800)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 5 Sep 2022 07:28:26 +0000 (17:28 +1000)
In ibmebus_match_path(), use of_node_put() to drop the reference
returned by of_find_node_by_path() before testing for equality of the
pointers.

Signed-off-by: Liang He <windhl@126.com>
[mpe: Rewrite change log]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220619074016.4068105-1-windhl@126.com
arch/powerpc/platforms/pseries/ibmebus.c

index 7ee3ed7d6cc211018773207d029735106f7c190f..a870cada7acd2313ec8c0d134a39a27a529507fe 100644 (file)
@@ -152,7 +152,11 @@ static const struct dma_map_ops ibmebus_dma_ops = {
 static int ibmebus_match_path(struct device *dev, const void *data)
 {
        struct device_node *dn = to_platform_device(dev)->dev.of_node;
-       return (of_find_node_by_path(data) == dn);
+       struct device_node *tn = of_find_node_by_path(data);
+
+       of_node_put(tn);
+
+       return (tn == dn);
 }
 
 static int ibmebus_match_node(struct device *dev, const void *data)