Re: [PATCH v2] usbcore: Add quirk for 255-bytes initial config read
From: Nikhil Solanke
Date: Tue Jun 30 2026 - 13:16:08 EST
> There's nothing wrong with trusting the caller to do the right thing.
> Besides, if a segfault does occur then it will be pretty obvious that
> the caller needs to be fixed.
>
> What would you do if buf is NULL? Return an error code? That won't
> help anyone locate the bug. Put an error message in the log? Segfaults
> are much more visible.
Understood. I guess my coding style is a little "too paranoid" and
"check everything and report errors". I understood now why this may
not always be the best approach in low level programming like kernel
development.
Anyways, I have done all the requested changes. Here's a short summary:
- put strings in a single line
- copy bytes from desc to bigbuffer instead of pointer aliasing. (so
no krealloc too)
- change tabs to spaces in documentation
- reworded some comments
- drop USB_CONFIG_WINDOWS_REQ_SIZE macro
- revert USB_DELAY_INIT to original behavior. no delay before 1st request.
Let me know if I missed any changes mentioned in previous discussions
(or misunderstood and made unnecessary changes :') ).
> I wonder if it wouldn't make sense to split announce_device() so that
> the first line is printed as soon as usb_new_device() starts, before
> enumeration is attempted and possibly fails.
The current patch still logs device ids upon failure in
usb_enumerate_device(). Do you want me to implement that suggestion?
Thanks,
Nikhil Solanke