Skip to contentSkip to conversation

PCI: Add device even if driver attach failed

PATCH RESEND Applied Rajat Jain 3 participants 3 messages Jul 6, 2020 – Jul 7, 2020

Subsystems (3)
lore
Share & tools
lore

Rajat Jain

author
#0 lore raw

PATCH RESEND v2 1/1 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.

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

---
Resending to stable, independent from other patches per Greg's suggestion
v2: Add Greg's reviewed by, fix commit log

 drivers/pci/bus.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/pci/bus.c +1 -5
index 8e40b3e6da77d..3cef835b375fd 100644
@@ -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);
 }
Signature · 1 line
2.27.0.212.ge8ba1cc988-goog
#1 lore raw
Quoted 4 lines · Rajat Jain

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.

Quoted 8 lines

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

---
Resending to stable, independent from other patches per Greg's suggestion
v2: Add Greg's reviewed by, fix commit log

<formletter>

This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

#2 lore raw
In reply to Rajat Jain
Quoted 4 lines · Rajat Jain

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.

Quoted 8 lines

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

---
Resending to stable, independent from other patches per Greg's suggestion
v2: Add Greg's reviewed by, fix commit log

Applied to pci/enumeration for v5.8 with stable tag, thanks!

Quoted 24 lines
 drivers/pci/bus.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/pci/bus.c +1 -5
index 8e40b3e6da77d..3cef835b375fd 100644
@@ -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);
 }
Signature · 1 line
2.27.0.212.ge8ba1cc988-goog