Skip to content

Commit 2194bc7

Browse files
Rajat Jainbjorn-helgaas
authored andcommitted
PCI: Add device even if driver attach failed
device_attach() returning failure indicates a driver error while trying to probe the device. In such a scenario, the PCI device should still be added in the system and be visible to the user. When device_attach() fails, merely warn about it and keep the PCI device in the system. This partially reverts ab1a187 ("PCI: Check device_attach() return value always"). Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rajat Jain <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Cc: [email protected] # v4.6+
1 parent 2a7e32d commit 2194bc7

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

drivers/pci/bus.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,8 @@ void pci_bus_add_device(struct pci_dev *dev)
322322

323323
dev->match_driver = true;
324324
retval = device_attach(&dev->dev);
325-
if (retval < 0 && retval != -EPROBE_DEFER) {
325+
if (retval < 0 && retval != -EPROBE_DEFER)
326326
pci_warn(dev, "device attach failed (%d)\n", retval);
327-
pci_proc_detach_device(dev);
328-
pci_remove_sysfs_dev_files(dev);
329-
return;
330-
}
331327

332328
pci_dev_assign_added(dev, true);
333329
}

0 commit comments

Comments
 (0)