[PATCH] powerpc: pseries: Fix refcount bug in ibmebus
Liang He
windhl at 126.com
Sun Jun 19 17:40:16 AEST 2022
In ibmebus_match_path(), we should use of_node_put() to keep
refcount balance.
Signed-off-by: Liang He <windhl at 126.com>
---
arch/powerpc/platforms/pseries/ibmebus.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/pseries/ibmebus.c b/arch/powerpc/platforms/pseries/ibmebus.c
index 7ee3ed7d6cc2..a870cada7acd 100644
--- a/arch/powerpc/platforms/pseries/ibmebus.c
+++ b/arch/powerpc/platforms/pseries/ibmebus.c
@@ -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)
--
2.25.1
More information about the Linuxppc-dev
mailing list