diff options
authorAidan MacDonald <>2021-11-14 14:19:44 +0000
committerAidan MacDonald <>2021-11-14 17:58:39 +0000
commit6e61e6f0c882ae4f6797b6a8c3ae92bb41e82893 (patch)
parentf8810be6decfabce76d2fc64940dc4ef442c0f9f (diff)
usb_core: don't buffer control request unnecessarily
Due to how the old control request API worked, the request pointer (and the pointed-to contents) passed by the driver must remain valid for the lifetime of the request. The buffered copy wasn't used consistently anyway, so it should be safe to just get rid of it. (This only affects the old API compatibility layer.) Change-Id: I00294c718a7515a91b84f7c7cae5220c73aa5960
1 files changed, 1 insertions, 3 deletions
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c
index 8e32e3501f..63df173033 100644
--- a/firmware/usbstack/usb_core.c
+++ b/firmware/usbstack/usb_core.c
@@ -264,7 +264,6 @@ static struct usb_class_driver drivers[USB_NUM_DRIVERS] =
-static struct usb_ctrlrequest active_request_buf;
static struct usb_ctrlrequest* volatile active_request = NULL;
static void* volatile control_write_data = NULL;
static volatile bool control_write_data_done = false;
@@ -1020,8 +1019,7 @@ void usb_core_control_complete(int status)
/* Only needed if the driver does not support the new API yet */
void usb_core_legacy_control_request(struct usb_ctrlrequest* req)
- memcpy(&active_request_buf, req, sizeof(*req));
- active_request = &active_request_buf;
+ active_request = req;
control_write_data = NULL;
control_write_data_done = false;