From ccd435496036cdceebb6d35df3edeb16695b0548 Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Sun, 27 Jul 2025 20:58:47 +0800 Subject: fix(port): reset sem when pipe free Signed-off-by: sakumisu <1203593632@qq.com> --- port/dwc2/usb_hc_dwc2.c | 2 ++ port/ehci/usb_hc_ehci.c | 2 ++ port/musb/usb_hc_musb.c | 2 ++ port/rp2040/usb_hc_rp2040.c | 2 ++ 4 files changed, 8 insertions(+) diff --git a/port/dwc2/usb_hc_dwc2.c b/port/dwc2/usb_hc_dwc2.c index a0660198..2bc4a265 100644 --- a/port/dwc2/usb_hc_dwc2.c +++ b/port/dwc2/usb_hc_dwc2.c @@ -484,6 +484,8 @@ static void dwc2_chan_free(struct dwc2_chan *chan) { size_t flags; + usb_osal_sem_reset(chan->waitsem); + flags = usb_osal_enter_critical_section(); if (chan->urb) { chan->urb->hcpriv = NULL; diff --git a/port/ehci/usb_hc_ehci.c b/port/ehci/usb_hc_ehci.c index e432a3f7..ac00a6db 100644 --- a/port/ehci/usb_hc_ehci.c +++ b/port/ehci/usb_hc_ehci.c @@ -98,6 +98,8 @@ static void ehci_qh_free(struct usbh_bus *bus, struct ehci_qh_hw *qh) struct ehci_qtd_hw *qtd; size_t flags; + usb_osal_sem_reset(qh->waitsem); + flags = usb_osal_enter_critical_section(); if (qh->urb) { qh->urb->hcpriv = NULL; diff --git a/port/musb/usb_hc_musb.c b/port/musb/usb_hc_musb.c index b16be99e..e8561a9a 100644 --- a/port/musb/usb_hc_musb.c +++ b/port/musb/usb_hc_musb.c @@ -477,6 +477,8 @@ static int musb_pipe_alloc(void) static void musb_pipe_free(struct musb_pipe *pipe) { + usb_osal_sem_reset(pipe->waitsem); + if (pipe->urb) { pipe->urb->hcpriv = NULL; pipe->urb = NULL; diff --git a/port/rp2040/usb_hc_rp2040.c b/port/rp2040/usb_hc_rp2040.c index 48f4128f..9f3000ca 100644 --- a/port/rp2040/usb_hc_rp2040.c +++ b/port/rp2040/usb_hc_rp2040.c @@ -71,6 +71,8 @@ static void rp2040_pipe_free(struct rp2040_pipe *pipe) { size_t flags; + usb_osal_sem_reset(pipe->waitsem); + flags = usb_osal_enter_critical_section(); if (pipe->urb) { pipe->urb->hcpriv = NULL; -- cgit v1.3.1