[PATCH] powerpc/pseries/iommu: Add of_node_put() before break

From: Wan Jiabing
Date: Thu Oct 14 2021 - 03:57:19 EST


Fix following coccicheck warning:

./arch/powerpc/platforms/pseries/iommu.c:924:1-28: WARNING: Function
for_each_node_with_property should have of_node_put() before break

Early exits from for_each_node_with_property should decrement the
node reference counter.

Signed-off-by: Wan Jiabing <wanjiabing@xxxxxxxx>
---
arch/powerpc/platforms/pseries/iommu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 269f61d519c2..c140aa683f66 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -929,8 +929,10 @@ static void find_existing_ddw_windows_named(const char *name)
}

window = ddw_list_new_entry(pdn, dma64);
- if (!window)
+ if (!window) {
+ of_node_put(pdn);
break;
+ }

spin_lock(&dma_win_list_lock);
list_add(&window->list, &dma_win_list);
--
2.20.1