usb_host: Fix incorrect memset() usage in HCD

This commit fixes incorrect usage of memset() in the HCD's various
_buffer_parse_...() functions. The memset was not clearing the qtd lists, and
were simply setting the first qtd to a non zero value (i.e., the length of
the QTD list).

However, no bug occurred as the subsequent _buffer_fill_...() functions would
overwrite the QTD list anyways.
pull/9803/head
Darian Leung 2022-09-02 18:38:54 +08:00 zatwierdzone przez Tomas Rezucha
rodzic fac9579d95
commit 89f828ee02
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -2342,7 +2342,7 @@ static inline void _buffer_parse_ctrl(dma_buffer_block_t *buffer)
//Update URB status
transfer->status = USB_TRANSFER_STATUS_COMPLETED;
//Clear the descriptor list
memset(buffer->xfer_desc_list, XFER_LIST_LEN_CTRL, sizeof(usbh_ll_dma_qtd_t));
memset(buffer->xfer_desc_list, 0, XFER_LIST_LEN_CTRL * sizeof(usbh_ll_dma_qtd_t));
}
static inline void _buffer_parse_bulk(dma_buffer_block_t *buffer)
@ -2358,7 +2358,7 @@ static inline void _buffer_parse_bulk(dma_buffer_block_t *buffer)
//Update URB's status
transfer->status = USB_TRANSFER_STATUS_COMPLETED;
//Clear the descriptor list
memset(buffer->xfer_desc_list, XFER_LIST_LEN_BULK, sizeof(usbh_ll_dma_qtd_t));
memset(buffer->xfer_desc_list, 0, XFER_LIST_LEN_BULK * sizeof(usbh_ll_dma_qtd_t));
}
static inline void _buffer_parse_intr(dma_buffer_block_t *buffer, bool is_in, int mps)
@ -2408,7 +2408,7 @@ static inline void _buffer_parse_intr(dma_buffer_block_t *buffer, bool is_in, in
//Update URB's status
transfer->status = USB_TRANSFER_STATUS_COMPLETED;
//Clear the descriptor list
memset(buffer->xfer_desc_list, XFER_LIST_LEN_INTR, sizeof(usbh_ll_dma_qtd_t));
memset(buffer->xfer_desc_list, 0, XFER_LIST_LEN_INTR * sizeof(usbh_ll_dma_qtd_t));
}
static inline void _buffer_parse_isoc(dma_buffer_block_t *buffer, bool is_in)