Re: [PATCH v2] usbcore: Add quirk for 255-bytes initial config read
From: Alan Stern
Date: Wed Jun 24 2026 - 10:01:31 EST
On Wed, Jun 24, 2026 at 01:36:28PM +0530, Nikhil Solanke wrote:
> > Actually, the best approach here would be to put this single change into
> > a separate patch that comes before the current one. That removes issues
> > of making more than one functional change in one patch and improves
> > bisectability.
>
> Before? Shouldn't it be after my changes? That would make it easier to
> justify the changes. And just to be sure, you did mention it does
> align with what the intention of USB_QUIRK_DELAY_INIT, but it does
> change its behavior when the quirk is not set. Atleast from what I
> understood from the documentation and an LLM's summary, the device
> needs time to prepare the full configuration set. So, does delaying
> before the first header read really work? I can't test this since I
> don't have a device that requires the quirk to be set.
>
> I personally think adding a condition to check if the quirk is set and
> then delaying before sending the first request would be appropriate.
> What are your opinions on this.
Well, put it this way: If you change the existing behavior, that change
belongs in a separate patch. If you want to redo this patch so that it
doesn't change anything when the quirk flag isn't set, that's fine.
> Also is it fine if the string lines exceed 100 columns?
In lines containing long strings, it's okay for the string to extend
well beyond 80 columns. But then you should break the line at some
point closely following the end of the string. I'm sure you can find
examples of this if you look through some of the other source files.
> Also, is there a need to check for krealloc()'s return value? Since we
> are only shrinking the buffer, there won't be any moves or completely
> new blocks (at least as per my understanding). Do I still need to
> check its return value for completeness' sake?
It's a little tricky to track this down, but if you look in
include/linux/slab.h you'll see that krealloc() is defined as
krealloc_node(), which is defined as krealloc_node_align(), which is
defined as krealloc_node_align_noprof(), which is declared with
__must_check. So yes, you need to check the return value from
krealloc().
Of course, you could simply try not checking the return value and seeing
if that provokes a warning or error from the compiler.
Alan Stern