summaryrefslogtreecommitdiff
path: root/src/tusb.c
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-12-12 00:51:57 +0700
committerhathach <[email protected]>2025-12-12 00:51:57 +0700
commit2f5d4dbab3a4b051eda35c7026d2568c7355decd (patch)
treec8d020af17c5e2e14adecd37b04e991d8eccfdef /src/tusb.c
parent711879b2f1bcb122c084e6a8bc93c5d2c599ab84 (diff)
fix edpt stream write/read to endpoint not yet opened
Diffstat (limited to 'src/tusb.c')
-rw-r--r--src/tusb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/tusb.c b/src/tusb.c
index f6ca3fabc..8ba9f0fff 100644
--- a/src/tusb.c
+++ b/src/tusb.c
@@ -332,6 +332,7 @@ bool tu_edpt_stream_init(tu_edpt_stream_t *s, bool is_host, bool is_tx, bool ove
}
static bool stream_claim(tu_edpt_stream_t *s) {
+ TU_VERIFY(s->ep_addr != 0); // must be opened
if (s->is_host) {
#if CFG_TUH_ENABLED
return usbh_edpt_claim(s->hwid, s->ep_addr);
@@ -446,6 +447,7 @@ uint32_t tu_edpt_stream_write_available(tu_edpt_stream_t *s) {
#if CFG_TUSB_EDPT_STREAM_NO_FIFO_ENABLED
if (0 == tu_fifo_depth(&s->ff)) {
// non-fifo mode
+ TU_VERIFY(s->ep_addr > 0); // must be opened
bool is_busy = true;
if (s->is_host) {
#if CFG_TUH_ENABLED