aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/85xx/ge_imp3a.c
diff options
context:
space:
mode:
authorLiang He <windhl@126.com>2022-07-01 22:01:19 +0800
committerMichael Ellerman <mpe@ellerman.id.au>2022-09-05 17:30:29 +1000
commita8b89c10e6052027061a447ff7436642310c8f20 (patch)
treed8fadb0d80d7f3086d503f81bc7be816135f3324 /arch/powerpc/platforms/85xx/ge_imp3a.c
parentpowerpc/44x: Add of_node_put() when break out from for_each (diff)
downloadlinux-dev-a8b89c10e6052027061a447ff7436642310c8f20.tar.xz
linux-dev-a8b89c10e6052027061a447ff7436642310c8f20.zip
powerpc/85xx: Add missing of_node_get/put() in ge_imp3a_pci_assign_primary()
for_each_node_by_type() will automatically increase and decrease the refcount during the iteration. However, there is a reference escaped into global 'fsl_pci_primary' and we need to handle it. Signed-off-by: Liang He <windhl@126.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20220701140119.245435-1-windhl@126.com
Diffstat (limited to '')
-rw-r--r--arch/powerpc/platforms/85xx/ge_imp3a.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/powerpc/platforms/85xx/ge_imp3a.c b/arch/powerpc/platforms/85xx/ge_imp3a.c
index 8e827376d97b..e3e8f18825a1 100644
--- a/arch/powerpc/platforms/85xx/ge_imp3a.c
+++ b/arch/powerpc/platforms/85xx/ge_imp3a.c
@@ -89,8 +89,10 @@ static void __init ge_imp3a_pci_assign_primary(void)
of_device_is_compatible(np, "fsl,mpc8548-pcie") ||
of_device_is_compatible(np, "fsl,p2020-pcie")) {
of_address_to_resource(np, 0, &rsrc);
- if ((rsrc.start & 0xfffff) == 0x9000)
- fsl_pci_primary = np;
+ if ((rsrc.start & 0xfffff) == 0x9000) {
+ of_node_put(fsl_pci_primary);
+ fsl_pci_primary = of_node_get(np);
+ }
}
}
#endif