[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241004230516.5eb3f7a4@foxbook>
Date: Fri, 4 Oct 2024 23:05:16 +0200
From: MichaĆ Pecio <michal.pecio@...il.com>
To: Olivier Dautricourt <olivierdautricourt@...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.
> 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
Well, simplifying things is not bad in principle, but in this case it
looks like this patch adds a branch and some 50 bytes of code/data for
the sake of optimizing something with no practical relevance (any such
hardware is useless, rejected by this driver, and violates the spec).
So, maybe just not worth the cost, no matter how small ;)
Regards,
Michal
Powered by blists - more mailing lists