aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci-sysfs.c
diff options
context:
space:
mode:
authorDavid Miller <davem@davemloft.net>2006-11-10 15:27:48 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-11-13 10:40:42 -0500
commitd67afe5ed00070de0965bfc98de5f6ed3a80a73e (patch)
treed67190334aa3de68232b095c13cf08c9a209c49f /drivers/pci/pci-sysfs.c
parent2b4ac44e7c7e16cf9411b81693ff3e604f332bf1 (diff)
[PATCH] pci: don't try to remove sysfs files before they are setup.
The PCI sysfs attributes are created after the initial PCI bus scan. With the addition of more return value checking and assertions in the device and sysfs layers we now can get dumps like this on sparc64: [ 20.135032] Call Trace: [ 20.135042] [0000000000537f88] pci_remove_bus_device+0x30/0xc0 [ 20.135076] [000000000078f890] pci_fill_in_pbm_cookies+0x98/0x440 [ 20.135109] [000000000042e828] sabre_scan_bus+0x230/0x400 [ 20.135139] [000000000078c710] pcibios_init+0x58/0xa0 [ 20.135159] [0000000000416f14] init+0x9c/0x2e0 [ 20.135190] [0000000000417a50] kernel_thread+0x38/0x60 [ 20.135211] [0000000000417170] rest_init+0x18/0x40 [ 20.135514] PCI0(PBMB): Bus running at 33MHz It's triggering because removal of the "config" PCI sysfs file for the device fails. On sparc64, after probing the device, we'll delete the PCI device via pci_remove_bus_device() if we cannot find the firmware device tree node corresponding to it. This is fine, but at this point the sysfs files for the PCI device won't be setup yet. So we should not try to do anything in pci_remove_sysfs_dev_files() if pci_sysfs_init() has not run yet. Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/pci/pci-sysfs.c')
-rw-r--r--drivers/pci/pci-sysfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index a1d2e979b17f..f952bfea48a6 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -642,6 +642,9 @@ err:
642 */ 642 */
643void pci_remove_sysfs_dev_files(struct pci_dev *pdev) 643void pci_remove_sysfs_dev_files(struct pci_dev *pdev)
644{ 644{
645 if (!sysfs_initialized)
646 return;
647
645 if (pdev->cfg_size < 4096) 648 if (pdev->cfg_size < 4096)
646 sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); 649 sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr);
647 else 650 else