Skip to content

Commit

Permalink
powerpc/pci: Reorder pci bus/bridge unregistration during PHB removal
Browse files Browse the repository at this point in the history
Commit bcdde7e made __sysfs_remove_dir() recursive and introduced a BUG_ON
during PHB removal while attempting to delete the power managment attribute
group of the bus. This is a result of tearing the bridge and bus devices down
out of order in remove_phb_dynamic. Since, the the bus resides below the bridge
in the sysfs device tree it should be torn down first.

This patch simply moves the device_unregister call for the PHB bridge device
after the device_unregister call for the PHB bus.

Fixes: bcdde7e ("sysfs: make __sysfs_remove_dir() recursive")
Cc: stable@vger.kernel.org
Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Tyrel Datwyler authored and Benjamin Herrenschmidt committed Aug 5, 2014
1 parent a32305b commit 7340056
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/pseries/pci_dlpar.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ int remove_phb_dynamic(struct pci_controller *phb)
}
}

/* Unregister the bridge device from sysfs and remove the PCI bus */
device_unregister(b->bridge);
/* Remove the PCI bus and unregister the bridge device from sysfs */
phb->bus = NULL;
pci_remove_bus(b);
device_unregister(b->bridge);

/* Now release the IO resource */
if (res->flags & IORESOURCE_IO)
Expand Down

0 comments on commit 7340056

Please sign in to comment.