[PATCH] usb: gadget: fastboot: avoid stale IN dequeue

Marek Vasut marek.vasut at mailbox.org
Mon Jun 1 02:05:37 CEST 2026


On 6/1/26 12:55 AM, Sam Day wrote:

Hi,

>>> diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
>>> index 8df0e3f331d..fb7e47401ca 100644
>>> --- a/drivers/usb/gadget/f_fastboot.c
>>> +++ b/drivers/usb/gadget/f_fastboot.c
>>> @@ -406,7 +406,8 @@ static int fastboot_tx_write(const char *buffer, unsigned int buffer_size)
>>>    	memcpy(in_req->buf, buffer, buffer_size);
>>>    	in_req->length = buffer_size;
>>>
>>> -	usb_ep_dequeue(fastboot_func->in_ep, in_req);
>>> +	if (IS_ENABLED(CONFIG_USB_MUSB_GADGET))
>>> +		usb_ep_dequeue(fastboot_func->in_ep, in_req);
>> This won't work on systems that have multiple disparate USB controllers.
> 
> I think I follow you, but could you please expand on this a little so I'm
> not guessing as to what you mean?
> 
> My understanding is you're saying this won't work if one builds with two
> different UDC drivers enabled, one being MUSB.

Right, if your system contains e.g. MUSB and DWC3 controllers, this will 
break on one or the other.

> That's true, and in that case fastboot might continue to cause issues. As I
> noted in the original patch, I have no idea if MUSB still needs this workaround
> introduced 10+ years ago, I don't have any MUSB hardware to test on.
> 
> Or are you suggesting that introducing this gating on Kconfig symbol is broken?
> 
>>
>> Why was the workaround added in the first place ?
>>
> It was introduced by bc9071c9f318, which specifically spoke about MUSB issues.
+CC Paul


More information about the U-Boot mailing list