[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZwA-n56XlNkkLNXM@freebase>
Date: Fri, 4 Oct 2024 21:14:39 +0200
From: Olivier Dautricourt <olivierdautricourt@...il.com>
To: Michał Pecio <michal.pecio@...il.com>
Cc: gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
linux-usb@...r.kernel.org, mathias.nyman@...el.com
Subject: Re: [PATCH] usb: xhci: xhci_setup_port_arrays: early -ENODEV if
maxports is 0.
Hello,
On Fri, Oct 04, 2024 at 12:57:16PM +0200, Michał Pecio wrote:
> Hi,
>
> > 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).
>
> This function runs once during HC initialization, so what's the benefit
> of bypassing it? Does it take unusually long time? Does it panic?
>
> It seems to alreday be written to handle such abnormal cases gracefully.
That is correct, the case is handled without panic, but the 0 value gets
silently propagated until it eventually fails on line 2220:
if (xhci->usb2_rhub.num_ports == 0 && xhci->usb3_rhub.num_ports == 0) {
xhci_warn(xhci, "No ports on the roothubs?\n");
return -ENODEV;
}
The benefits are only:
- Reporting a more precise issue
- Avoids iterating through the capability structures of the controller
- failsafe if future changes
This is totally a nitpick as the case is unusual, if you think it is not
worth taking it upstream i'll understand.
Kr,
Olivier
Powered by blists - more mailing lists