diff mbox series

[v2,4/7] PCI: Add device even if driver attach failed

Message ID 20200630044943.3425049-5-rajatja@google.com
State Accepted
Commit 2194bc7c39610be7cabe7456c5f63a570604f015
Headers show
Series [v2,1/7] PCI: Keep the ACS capability offset in device | expand

Commit Message

Rajat Jain June 30, 2020, 4:49 a.m. UTC
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.

This patch partially reverts:
commit ab1a187bba5c ("PCI: Check device_attach() return value always")

Signed-off-by: Rajat Jain <rajatja@google.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
v2: Cosmetic change in commit log.
    Add Greg's "reviewed-by"

 drivers/pci/bus.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Rajat Jain July 6, 2020, 11:35 p.m. UTC | #1
On Tue, Jun 30, 2020 at 1:02 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>

> On Mon, Jun 29, 2020 at 09:49:40PM -0700, Rajat Jain wrote:

> > 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.

> >

> > This patch partially reverts:

> > commit ab1a187bba5c ("PCI: Check device_attach() return value always")

> >

> > Signed-off-by: Rajat Jain <rajatja@google.com>

> > Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

> > ---

> > v2: Cosmetic change in commit log.

> >     Add Greg's "reviewed-by"

> >

> >  drivers/pci/bus.c | 6 +-----

> >  1 file changed, 1 insertion(+), 5 deletions(-)

> >

> > diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c

> > index 8e40b3e6da77d..3cef835b375fd 100644

> > --- a/drivers/pci/bus.c

> > +++ b/drivers/pci/bus.c

> > @@ -322,12 +322,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)

> >               pci_warn(dev, "device attach failed (%d)\n", retval);

> > -             pci_proc_detach_device(dev);

> > -             pci_remove_sysfs_dev_files(dev);

> > -             return;

> > -     }

> >

> >       pci_dev_assign_added(dev, true);

> >  }

>

> This should go first in the series, and cc: stable and get merged now.

> No need to tie it to this series at all.

>

> Or just an independant patch, it doesn't have much to do with this

> series, it's a bugfix.


Resent this patch as an independent patch with cc:stable here:
https://lore.kernel.org/patchwork/patch/1268456/

Thanks,

Rajat

>

> thanks,

>

> greg k-h
diff mbox series

Patch

diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index 8e40b3e6da77d..3cef835b375fd 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -322,12 +322,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)
 		pci_warn(dev, "device attach failed (%d)\n", retval);
-		pci_proc_detach_device(dev);
-		pci_remove_sysfs_dev_files(dev);
-		return;
-	}
 
 	pci_dev_assign_added(dev, true);
 }