summaryrefslogtreecommitdiff
path: root/src/common/tusb_debug.h
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-11-19 11:32:44 +0700
committerhathach <[email protected]>2025-11-19 11:32:44 +0700
commitfd3161087d76c84fb21e8e2f2d30a81d6b11bfba (patch)
tree527172cad87c76062490e4ecc9277e21d3691224 /src/common/tusb_debug.h
parentbe4b38c54dc4e23af322ae04eda1f30e5ced0289 (diff)
parentd46f71bdde8b3160b0efaf83598d6b4cf596f787 (diff)
Merge branch 'refs/heads/master' into dwc2_ep0
# Conflicts: # examples/device/dfu/src/usb_descriptors.c # examples/device/dfu_runtime/src/usb_descriptors.c # src/device/usbd_control.c # src/portable/synopsys/dwc2/dcd_dwc2.c
Diffstat (limited to 'src/common/tusb_debug.h')
-rw-r--r--src/common/tusb_debug.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/common/tusb_debug.h b/src/common/tusb_debug.h
index e3f9d3f18..e0e09f5ce 100644
--- a/src/common/tusb_debug.h
+++ b/src/common/tusb_debug.h
@@ -55,7 +55,8 @@ void tu_print_mem(void const *buf, uint32_t count, uint8_t indent);
extern int CFG_TUSB_DEBUG_PRINTF(const char *format, ...);
#define tu_printf CFG_TUSB_DEBUG_PRINTF
#else
- #define tu_printf printf
+ #include <stdio.h>
+ #define tu_printf(...) (void) printf(__VA_ARGS__)
#endif
TU_ATTR_ALWAYS_INLINE static inline void tu_print_buf(uint8_t const* buf, uint32_t bufsize) {
@@ -118,7 +119,9 @@ static inline const char* tu_lookup_find(tu_lookup_table_t const* p_table, uint3
// not found return the key value in hex
static char not_found[11];
- snprintf(not_found, sizeof(not_found), "0x%08lX", (unsigned long) key);
+ if (snprintf(not_found, sizeof(not_found), "0x%08lX", (unsigned long) key) <= 0) {
+ not_found[0] = 0;
+ }
return not_found;
}