diff options
| author | sakumisu <[email protected]> | 2024-09-18 18:36:17 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2024-09-19 09:50:18 +0800 |
| commit | 02340e0f44b95f23c227f6d7528f41c0bfe1c0ac (patch) | |
| tree | eca96f5e87b747d84fbb90874abbcf6cfdd3382b /core | |
| parent | 171b36e766d36e647c3f7531e8460bb26dab105e (diff) | |
chore: static code analysis
Diffstat (limited to 'core')
| -rw-r--r-- | core/usbd_core.c | 6 | ||||
| -rw-r--r-- | core/usbh_core.c | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/core/usbd_core.c b/core/usbd_core.c index 4742da6a..4cdd87cf 100644 --- a/core/usbd_core.c +++ b/core/usbd_core.c @@ -1406,6 +1406,12 @@ int usbd_initialize(uint8_t busid, uintptr_t reg_base, void (*event_handler)(uin int usbd_deinitialize(uint8_t busid) { + if (busid >= CONFIG_USBDEV_MAX_BUS) { + USB_LOG_ERR("bus overflow\r\n"); + while (1) { + } + } + g_usbd_core[busid].event_handler(busid, USBD_EVENT_DEINIT); usbd_class_event_notify_handler(busid, USBD_EVENT_DEINIT, NULL); usb_dc_deinit(busid); diff --git a/core/usbh_core.c b/core/usbh_core.c index 2429b981..d4de88e5 100644 --- a/core/usbh_core.c +++ b/core/usbh_core.c @@ -651,6 +651,12 @@ int usbh_deinitialize(uint8_t busid) { struct usbh_bus *bus; + if (busid >= CONFIG_USBHOST_MAX_BUS) { + USB_LOG_ERR("bus overflow\r\n"); + while (1) { + } + } + bus = &g_usbhost_bus[busid]; usbh_hub_deinitialize(bus); |
