powerpc: 85xx: Fix refcount bugs in ge_imp3a_pci_assign_primary()
Subsystems (2)
PATCH 1/1 powerpc: 85xx: Fix refcount bugs 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 <[email protected]>
--- arch/powerpc/platforms/85xx/ge_imp3a.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/platforms/85xx/ge_imp3a.c +4 -2
@@ -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
Signature · 1 line
2.25.1
Michael Ellerman
AppliedQuoted 5 lines · Liang He
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.
Applied to powerpc/next.
[1/1] powerpc: 85xx: Fix refcount bugs in ge_imp3a_pci_assign_primary()
https://git.kernel.org/powerpc/c/a8b89c10e6052027061a447ff7436642310c8f20
cheers