mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
usb: gadget: Store endpoint pointer in usb_request
Gadget function drivers often have goto-based error handling in their bind paths, which can be bug-prone. Refactoring these paths to use __free() scope-based cleanup is desirable, but currently blocked. The blocker is that usb_ep_free_request(ep, req) requires two parameters, while the __free() mechanism can only pass a pointer to the request itself. Store an endpoint pointer in the struct usb_request. The pointer is populated centrally in usb_ep_alloc_request() on every successful allocation, making the request object self-contained. Signed-off-by: Kuen-Han Tsai <khtsai@google.com> Link: https://lore.kernel.org/r/20250916-ready-v1-1-4997bf277548@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20250916-ready-v1-1-4997bf277548@google.com
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
1b237f190e
commit
bfb1d99d96
@@ -32,6 +32,7 @@ struct usb_ep;
|
||||
|
||||
/**
|
||||
* struct usb_request - describes one i/o request
|
||||
* @ep: The associated endpoint set by usb_ep_alloc_request().
|
||||
* @buf: Buffer used for data. Always provide this; some controllers
|
||||
* only use PIO, or don't use DMA for some endpoints.
|
||||
* @dma: DMA address corresponding to 'buf'. If you don't set this
|
||||
@@ -98,6 +99,7 @@ struct usb_ep;
|
||||
*/
|
||||
|
||||
struct usb_request {
|
||||
struct usb_ep *ep;
|
||||
void *buf;
|
||||
unsigned length;
|
||||
dma_addr_t dma;
|
||||
|
||||
Reference in New Issue
Block a user