diff options
author | Rajat Jain <rajatja@google.com> | 2020-07-06 16:32:40 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-12-02 08:31:25 +0100 |
commit | 84a734234726fd8348b282c419686816bbdd3c04 (patch) | |
tree | 3678adeedbba8be9d607f60a8fe6c7a128fe311c | |
parent | 0ec766bfb55c647d52185f468a5d1b8adaec7f29 (diff) | |
download | linux-stable-84a734234726fd8348b282c419686816bbdd3c04.tar.gz linux-stable-84a734234726fd8348b282c419686816bbdd3c04.tar.bz2 linux-stable-84a734234726fd8348b282c419686816bbdd3c04.zip |
PCI: Add device even if driver attach failed
commit 2194bc7c39610be7cabe7456c5f63a570604f015 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 ab1a187bba5c ("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+
[sudip: use dev_warn]
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/pci/bus.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index c288e5a52575..32001787cff3 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -324,12 +324,8 @@ void pci_bus_add_device(struct pci_dev *dev) dev->match_driver = true; retval = device_attach(&dev->dev); - if (retval < 0 && retval != -EPROBE_DEFER) { + if (retval < 0 && retval != -EPROBE_DEFER) dev_warn(&dev->dev, "device attach failed (%d)\n", retval); - pci_proc_detach_device(dev); - pci_remove_sysfs_dev_files(dev); - return; - } dev->is_added = 1; } |