Re: [PATCH net v3] r8152: check the informaton of the device

From
Johan Hovold <johan@kernel.org>
Date
2021-05-24 09:13:48
Also in
linux-usb, lkml
Reply to
Hayes Wang, 2021-05-24
On Mon, May 24, 2021 at 08:54:50AM +0000, Hayes Wang wrote:
Johan Hovold [off-list ref]
quoted
Sent: Monday, May 24, 2021 4:01 PM
[...]
quoted
quoted
 	/* The vendor mode is not always config #1, so to find it out. */
 	udev = interface_to_usbdev(intf);
 	c = udev->config;
 	num_configs = udev->descriptor.bNumConfigurations;
+	if (num_configs < 2)
+		return false;
+
Nit: This check looks unnecessary also as the driver can handle a single
configuration just fine, and by removing it you'd be logging "Unexpected
Device\n" below also in the single config case.
I just want to distinguish the devices.
It is acceptable if the device contains only one configuration.
A mistake occurs if the device has more configurations and
there is no expected one.
I would remove it if you think it is better.
I'm fine with keeping the check too (e.g. as an optimisation of sort),
it's just a bit inconsistent to not log an error in that one error path.

Johan
Thread (13 messages) 13 messages, 4 authors, last reply 2021-05-24
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help