Skip to content

Commit

Permalink
usb: usb_dc_dw: Check endpoint is valid
Browse files Browse the repository at this point in the history
Fix harness test issues.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
  • Loading branch information
finikorg authored and nashif committed Apr 18, 2019
1 parent 81fbf0f commit 582b440
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/usb/device/usb_dc_dw.c
Expand Up @@ -990,6 +990,11 @@ int usb_dc_ep_disable(const u8_t ep)
{ {
u8_t ep_idx = USB_DW_EP_ADDR2IDX(ep); u8_t ep_idx = USB_DW_EP_ADDR2IDX(ep);


if (!usb_dw_ctrl.attached || !usb_dw_ep_is_valid(ep)) {
LOG_ERR("Not attached / Invalid endpoint: EP 0x%x", ep);
return -EINVAL;
}

/* Disable EP interrupts */ /* Disable EP interrupts */
if (USB_DW_EP_ADDR2DIR(ep) == USB_EP_DIR_OUT) { if (USB_DW_EP_ADDR2DIR(ep) == USB_EP_DIR_OUT) {
USB_DW->daintmsk &= ~USB_DW_DAINT_OUT_EP_INT(ep_idx); USB_DW->daintmsk &= ~USB_DW_DAINT_OUT_EP_INT(ep_idx);
Expand Down

0 comments on commit 582b440

Please sign in to comment.