u-boot-dfu-20260521

CI: https://source.denx.de/u-boot/custodians/u-boot-dfu/-/pipelines/30195

Usb Gadget:
* f_acm: Fix memory leak in acm_add()
* atmel: Fix gadget support on bus reset
This commit is contained in:
Tom Rini
2026-05-21 10:26:29 -06:00
2 changed files with 7 additions and 23 deletions

View File

@@ -289,10 +289,6 @@ static int usba_ep_disable(struct usb_ep *_ep)
if (!ep->desc) {
spin_unlock_irqrestore(&udc->lock, flags);
/* REVISIT because this driver disables endpoints in
* reset_all_endpoints() before calling disconnect(),
* most gadget drivers would trigger this non-error ...
*/
if (udc->gadget.speed != USB_SPEED_UNKNOWN)
DBG(DBG_ERR, "ep_disable: %s not enabled\n",
ep->ep.name);
@@ -571,20 +567,6 @@ static void reset_all_endpoints(struct usba_udc *udc)
list_del_init(&req->queue);
request_complete(ep, req, -ECONNRESET);
}
/* NOTE: normally, the next call to the gadget driver is in
* charge of disabling endpoints... usually disconnect().
* The exception would be entering a high speed test mode.
*
* FIXME remove this code ... and retest thoroughly.
*/
list_for_each_entry(ep, &udc->gadget.ep_list, ep.ep_list) {
if (ep->desc) {
spin_unlock(&udc->lock);
usba_ep_disable(&ep->ep);
spin_lock(&udc->lock);
}
}
}
static struct usba_ep *get_ep_by_addr(struct usba_udc *udc, u16 wIndex)

View File

@@ -548,13 +548,11 @@ static int acm_add(struct usb_configuration *c)
status = udc_device_get_by_index(0, &f_acm->udc);
if (status)
return status;
goto err;
status = usb_add_function(c, &f_acm->usb_function);
if (status) {
free(f_acm);
return status;
}
if (status)
goto err;
buf_init(&f_acm->rx_buf, 2048);
buf_init(&f_acm->tx_buf, 2048);
@@ -562,6 +560,10 @@ static int acm_add(struct usb_configuration *c)
if (!default_acm_function)
default_acm_function = f_acm;
return 0;
err:
free(f_acm);
return status;
}