From 82596cea4bcbb1b9798ebf68fced903068a00a57 Mon Sep 17 00:00:00 2001 From: sakimisu <1203593632@qq.com> Date: Thu, 15 Dec 2022 20:18:53 +0800 Subject: fix usb_osal_enter_critical_section in usbh_submit_urb --- port/dwc2/usb_hc_dwc2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'port/dwc2') diff --git a/port/dwc2/usb_hc_dwc2.c b/port/dwc2/usb_hc_dwc2.c index 116649a1..f72e89c5 100644 --- a/port/dwc2/usb_hc_dwc2.c +++ b/port/dwc2/usb_hc_dwc2.c @@ -769,8 +769,6 @@ int usbh_submit_urb(struct usbh_urb *urb) return -EINVAL; } - flags = usb_osal_enter_critical_section(); - if (!chan->hport->connected) { return -ENODEV; } @@ -779,6 +777,8 @@ int usbh_submit_urb(struct usbh_urb *urb) return -EBUSY; } + flags = usb_osal_enter_critical_section(); + chan->waiter = false; chan->xfrd = 0; chan->urb = urb; @@ -836,6 +836,7 @@ int usbh_kill_urb(struct usbh_urb *urb) flags = usb_osal_enter_critical_section(); dwc2_halt(pipe->chidx); + CLEAR_HC_INT(pipe->chidx, USB_OTG_HCINT_CHH); pipe->urb = NULL; usb_osal_leave_critical_section(flags); -- cgit v1.3.1