Re: [PATCH] usb: chipidea: udc: reject non-control requests while controller is suspended
From: Alan Stern
Date: Tue Mar 31 2026 - 11:51:13 EST
On Tue, Mar 31, 2026 at 12:21:45PM +0000, Andreea.Popescu@xxxxxxxxxxx wrote:
> When Linux runtime PM autosuspends a ChipIdea UDC that is still
> enumerated by the host, the driver gates the PHY clocks and marks
> the controller as suspended (ci->in_lpm = 1) but deliberately leaves
> gadget.speed unchanged so upper-layer gadget drivers do not see a
> spurious disconnect.
>
> The problem is that those same drivers may continue to call
> usb_ep_queue() during the autosuspend window. _hardware_enqueue()
> silently adds the request to the endpoint queue and returns 0, but
> hw_ep_prime() cannot succeed with gated clocks, so the completion
> interrupt never fires. The request — and its backing buffer — is
> permanently lost. The caller sees a successful return and never
> frees the buffer.
Won't the request complete normally after the gadget is resumed, or
abnormally after a reset, disconnect, or shutdown? Either way, it
wouldn't be lost permanently.
Alan Stern