Re: [PATCH] usb: hcd-pci: avoid double disable on surprise removal

From: Konrad Dybcio

Date: Wed Oct 21 2026 - 04:01:03 EST


On 10/20/26 9:55 PM, Alan Stern wrote:
> On Tue, Oct 20, 2026 at 03:52:28PM -0400, Alan Stern wrote:
>> On Tue, Oct 20, 2026 at 05:05:39PM +0200, Konrad Dybcio wrote:
>>> 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.
>>
>> Does the double disable actually cause any problems?

At the very least, from drivers/pci/pci.c:

void pci_disable_device(struct pci_dev *dev)
{
dev_WARN_ONCE(&dev->dev, atomic_read(&dev->enable_cnt) <= 0,
"disabling already-disabled device");


> Also, is your patch any different from this one from two days ago?
>
> https://lore.kernel.org/linux-usb/20261018164134.134106-1-cole@xxxxxxxxx/

No, we can take that one instead.

Konrad