drivers: usb: fix usb_dc_ep_mps() for the SAM0 for IN endpoints

The driver was returning zero due to accessing the, say, 0x81'th
endpoint instead of the 0x01'th endpoint.

Signed-off-by: Michael Hope <mlhx@google.com>
This commit is contained in:
Michael Hope 2020-06-18 22:15:23 +02:00 committed by Carles Cufí
commit ad7ea0d498

View file

@ -692,7 +692,7 @@ int usb_dc_ep_mps(const uint8_t ep)
uint8_t for_in = ep & USB_EP_DIR_MASK;
uint8_t ep_num = ep & ~USB_EP_DIR_MASK;
UsbDeviceDescriptor *desc = &data->descriptors[ep_num];
UsbDeviceEndpoint *endpoint = &regs->DeviceEndpoint[ep];
UsbDeviceEndpoint *endpoint = &regs->DeviceEndpoint[ep_num];
if (ep_num >= USB_NUM_ENDPOINTS) {
LOG_ERR("endpoint index/address out of range");