usb: dwc3: ep0: Don't reset resource alloc flag (including ep0)

The DWC3_EP_RESOURCE_ALLOCATED flag ensures that the resource of an
endpoint is only assigned once. Unless the endpoint is reset, don't
clear this flag. Otherwise we may set endpoint resource again, which
prevents the driver from initiate transfer after handling a STALL or
endpoint halt to the control endpoint.

Commit f2e0eee47038 ("usb: dwc3: ep0: Don't reset resource alloc flag")
was fixing the initial issue, but did this only for physical ep1. Since
the function dwc3_ep0_stall_and_restart is resetting the flags for both
physical endpoints, this also has to be done for ep0.

Cc: stable@vger.kernel.org
Fixes: b311048c174d ("usb: dwc3: gadget: Rewrite endpoint allocation flow")
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20240814-dwc3hwep0reset-v2-1-29e1d7d923ea@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by Michael Grzeschik and committed by Greg Kroah-Hartman 72fca837 3a8839bb

+2 -1
+2 -1
drivers/usb/dwc3/ep0.c
··· 232 /* stall is always issued on EP0 */ 233 dep = dwc->eps[0]; 234 __dwc3_gadget_ep_set_halt(dep, 1, false); 235 - dep->flags = DWC3_EP_ENABLED; 236 dwc->delayed_status = false; 237 238 if (!list_empty(&dep->pending_list)) {
··· 232 /* stall is always issued on EP0 */ 233 dep = dwc->eps[0]; 234 __dwc3_gadget_ep_set_halt(dep, 1, false); 235 + dep->flags &= DWC3_EP_RESOURCE_ALLOCATED; 236 + dep->flags |= DWC3_EP_ENABLED; 237 dwc->delayed_status = false; 238 239 if (!list_empty(&dep->pending_list)) {