All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Olivier Dautricourt <olivierdautricourt@gmail.com>
Cc: Mathias Nyman <mathias.nyman@intel.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: xhci: xhci_setup_port_arrays: early -ENODEV if maxports is 0.
Date: Fri, 4 Oct 2024 10:07:01 +0200	[thread overview]
Message-ID: <2024100407-hatless-goofy-bf12@gregkh> (raw)
In-Reply-To: <20240930052336.80589-1-olivierdautricourt@gmail.com>

On Mon, Sep 30, 2024 at 07:23:29AM +0200, Olivier Dautricourt wrote:
> If the controller reports HCSPARAMS1.maxports==0 then we can skip the
> whole function: it would fail later after doing a bunch of unnecessary
> stuff. It can occur on a buggy hardware (the value is driven by external
> signals).

What "buggy hardware" is this that can not pass the USB testing for this
type of issue?

> 
> Signed-off-by: Olivier Dautricourt <olivierdautricourt@gmail.com>
> ---
>  drivers/usb/host/xhci-mem.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
> index d2900197a49e..e8406db78782 100644
> --- a/drivers/usb/host/xhci-mem.c
> +++ b/drivers/usb/host/xhci-mem.c
> @@ -2160,6 +2160,11 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags)
>  	struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
>  
>  	num_ports = HCS_MAX_PORTS(xhci->hcs_params1);
> +	if (num_ports == 0) {
> +		xhci_warn(xhci, "Host controller has no port enabled\n");
> +		return -ENODEV;
> +	}

Should this be backported to older kernels, if so, how far back if this
is common hardware?

thanks,

greg k-h

  reply	other threads:[~2024-10-04  8:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-30  5:23 [PATCH] usb: xhci: xhci_setup_port_arrays: early -ENODEV if maxports is 0 Olivier Dautricourt
2024-10-04  8:07 ` Greg Kroah-Hartman [this message]
2024-10-04 19:04   ` Olivier Dautricourt
2024-10-04 10:57 ` Michał Pecio
2024-10-04 19:14   ` Olivier Dautricourt
2024-10-04 21:05     ` Michał Pecio
2024-10-10 12:50     ` Mathias Nyman

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=2024100407-hatless-goofy-bf12@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=olivierdautricourt@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.