summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2025-07-27 20:58:47 +0800
committersakumisu <[email protected]>2025-07-27 20:58:47 +0800
commitccd435496036cdceebb6d35df3edeb16695b0548 (patch)
treeae75737db7348672455d1fa460cd49bc4c77a8d5
parent60ac6fe3ad4b0cc544d4a4f1c947baec9e079cbb (diff)
fix(port): reset sem when pipe free
Signed-off-by: sakumisu <[email protected]>
-rw-r--r--port/dwc2/usb_hc_dwc2.c2
-rw-r--r--port/ehci/usb_hc_ehci.c2
-rw-r--r--port/musb/usb_hc_musb.c2
-rw-r--r--port/rp2040/usb_hc_rp2040.c2
4 files changed, 8 insertions, 0 deletions
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;