fix(port): enter section before alloc pipe
This commit is contained in:
@@ -684,19 +684,18 @@ int usbh_submit_urb(struct usbh_urb *urb)
|
||||
|
||||
bus = urb->hport->bus;
|
||||
|
||||
flags = usb_osal_enter_critical_section();
|
||||
|
||||
if (USB_GET_ENDPOINT_TYPE(urb->ep->bmAttributes) == USB_ENDPOINT_TYPE_CONTROL) {
|
||||
chidx = 0;
|
||||
} else {
|
||||
chidx = (urb->ep->bEndpointAddress & 0x0f);
|
||||
|
||||
if (chidx > (CONFIG_USBHOST_PIPE_NUM - 1)) {
|
||||
usb_osal_leave_critical_section(flags);
|
||||
return -USB_ERR_RANGE;
|
||||
}
|
||||
}
|
||||
|
||||
flags = usb_osal_enter_critical_section();
|
||||
|
||||
pipe = &g_musb_hcd[bus->hcd.hcd_id].pipe_pool[chidx];
|
||||
pipe->chidx = chidx;
|
||||
pipe->urb = urb;
|
||||
@@ -705,8 +704,6 @@ int usbh_submit_urb(struct usbh_urb *urb)
|
||||
urb->errorcode = -USB_ERR_BUSY;
|
||||
urb->actual_length = 0;
|
||||
|
||||
usb_osal_sem_reset(pipe->waitsem);
|
||||
|
||||
switch (USB_GET_ENDPOINT_TYPE(urb->ep->bmAttributes)) {
|
||||
case USB_ENDPOINT_TYPE_CONTROL:
|
||||
pipe->ep0_state = USB_EP0_STATE_SETUP;
|
||||
|
||||
Reference in New Issue
Block a user