mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: hcd-pci: avoid double disable on surprise removal
Date: Tue, 20 Oct 2026 15:52:28 -0400	[thread overview]
Message-ID: <a25e2100-e01f-49b7-b794-da1027dffedf@rowland.harvard.edu> (raw)
In-Reply-To: <20261020-topic-hub_pci-v1-1-bccdaef0344f@oss.qualcomm.com>

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?

Alan Stern

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

  reply	other threads:[~2026-10-20 19:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20 15:05 Konrad Dybcio
2026-10-20 19:52 ` Alan Stern [this message]
2026-10-20 19:55   ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a25e2100-e01f-49b7-b794-da1027dffedf@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=gregkh@linuxfoundation.org \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®