summaryrefslogtreecommitdiff
path: root/src/host
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-10-17 16:26:27 +0700
committerhathach <[email protected]>2021-10-17 16:36:53 +0700
commita5f516893bbd539f11fb8d1cbb5b6db5a50fc632 (patch)
tree1d9f344ae3b7ed1a56b27bcbb11c4ff9d1ae07de /src/host
parent0b249618b0469529da748e3e5478751cd56acd31 (diff)
more with -Wcast-qual
Diffstat (limited to 'src/host')
-rw-r--r--src/host/usbh.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/host/usbh.c b/src/host/usbh.c
index 2ef936ad0..53e8b9715 100644
--- a/src/host/usbh.c
+++ b/src/host/usbh.c
@@ -894,11 +894,10 @@ static bool enum_get_9byte_config_desc_complete(uint8_t dev_addr, tusb_control_r
TU_ASSERT(XFER_RESULT_SUCCESS == result);
// TODO not enough buffer to hold configuration descriptor
- tusb_desc_configuration_t const * desc_config = (tusb_desc_configuration_t const*) _usbh_ctrl_buf;
- uint16_t total_len;
+ uint8_t const * desc_config = _usbh_ctrl_buf;
// Use offsetof to avoid pointer to the odd/misaligned address
- memcpy(&total_len, (uint8_t*) desc_config + offsetof(tusb_desc_configuration_t, wTotalLength), 2);
+ uint16_t const total_len = tu_le16toh( tu_unaligned_read16(desc_config + offsetof(tusb_desc_configuration_t, wTotalLength)) );
TU_ASSERT(total_len <= CFG_TUH_ENUMERATION_BUFSIZE);