diff --git a/core/usbd_core.c b/core/usbd_core.c index e2ced33c45453cdb141ff1893f2a15e221988ffa..7eb634991ccae1af693f624af509ff90a2e59340 100644 --- a/core/usbd_core.c +++ b/core/usbd_core.c @@ -939,8 +939,18 @@ static void usbd_class_event_notify_handler(uint8_t event, void *arg) { struct usbd_interface *intf = usb_slist_entry(i, struct usbd_interface, list); - if (intf->notify_handler) { - intf->notify_handler(event, arg); + if (arg == NULL) { + if (intf->notify_handler) { + intf->notify_handler(event, arg); + } + } + else { + struct usb_interface_descriptor *intf_arg = (struct usb_interface_descriptor *)arg; + if (intf->intf_num == intf_arg->bInterfaceNumber) { + if (intf->notify_handler) { + intf->notify_handler(event, arg); + } + } } } } diff --git a/port/musb/usb_hc_musb.c b/port/musb/usb_hc_musb.c index d55dc56147aa894a425791fd768be5870f68f5aa..51f47400b860fed689f90bbf324170ec3ed29fb3 100644 --- a/port/musb/usb_hc_musb.c +++ b/port/musb/usb_hc_musb.c @@ -921,6 +921,7 @@ void USBH_IRQHandler(void) pipe = &g_musb_hcd.pipe_pool[ep_idx][0]; urb = pipe->urb; + if (urb == NULL) continue; musb_set_active_ep(ep_idx); ep_csrl_status = HWREGB(USB_BASE + MUSB_IND_TXCSRL_OFFSET);