mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] usb: hcd-pci: avoid double disable on surprise removal
@ 2026-10-20 15:05 Konrad Dybcio
  0 siblings, 0 replies; only message in thread
From: Konrad Dybcio @ 2026-10-20 15:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, linux-kernel, Konrad Dybcio

A PCI HCD can be surprise-removed after suspend_common() disables it
and before resume_common() re-enables it. Avoid a second call to
pci_disable_device() in the remove path when no enable reference
remains.

Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
 drivers/usb/core/hcd-pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index cd223475917ef199511311eda5c6aaef073b0ad4..34c4d352b40c40c54cf17c30fc264833ba05bcd6 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -348,7 +348,9 @@ void usb_hcd_pci_remove(struct pci_dev *dev)
 	usb_put_hcd(hcd);
 	if ((hcd_driver_flags & HCD_MASK) < HCD_USB3)
 		pci_free_irq_vectors(dev);
-	pci_disable_device(dev);
+
+	if (pci_is_enabled(dev))
+		pci_disable_device(dev);
 }
 EXPORT_SYMBOL_GPL(usb_hcd_pci_remove);
 

---
base-commit: f5f84daefcd92d7a630066635ecea1433ed5eac7
change-id: 20261020-topic-hub_pci-903b8c18d17b

Best regards,
-- 
Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-20 15:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-20 15:05 [PATCH] usb: hcd-pci: avoid double disable on surprise removal Konrad Dybcio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®