Skip to content

Commit ae33b1e

Browse files
Rajat Jaingregkh
authored andcommitted
PCI: Add device even if driver attach failed
commit 2194bc7 upstream. 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/20200706233240.3245512-1-rajatja@google.com Signed-off-by: Rajat Jain <rajatja@google.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: stable@vger.kernel.org # v4.6+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 71c6716 commit ae33b1e

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

drivers/pci/bus.c

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

324324
dev->match_driver = true;
325325
retval = device_attach(&dev->dev);
326-
if (retval < 0 && retval != -EPROBE_DEFER) {
326+
if (retval < 0 && retval != -EPROBE_DEFER)
327327
pci_warn(dev, "device attach failed (%d)\n", retval);
328-
pci_proc_detach_device(dev);
329-
pci_remove_sysfs_dev_files(dev);
330-
return;
331-
}
332328

333329
pci_dev_assign_added(dev, true);
334330
}

0 commit comments

Comments
 (0)