diff options
| author | Ha Thach <[email protected]> | 2025-11-09 00:26:04 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-11-09 00:26:04 +0700 |
| commit | 96f35fc0a559aa09da70e0dede5a43081615723f (patch) | |
| tree | 8ed03653c36a3c9e84c9463aa729d1de4d3af2d7 /src/device | |
| parent | 91c3a4fa8d1a88880f262b2a3a227374128de3f3 (diff) | |
| parent | 7f173ab5ed6a80a5fd6780779fe63fb97d2be0e9 (diff) | |
Merge pull request #3334 from hathach/fix-alerts-3
Fix more code alerts
Diffstat (limited to 'src/device')
| -rw-r--r-- | src/device/usbd.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c index 9d0bc0f3f..cf96f050d 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -352,11 +352,13 @@ TU_ATTR_ALWAYS_INLINE static inline usbd_class_driver_t const * get_driver(uint8 if (drvid < _app_driver_count) { // Application drivers driver = &_app_driver[drvid]; - } else if (drvid < TOTAL_DRIVER_COUNT && BUILTIN_DRIVER_COUNT > 0) { - driver = &_usbd_driver[drvid - _app_driver_count]; - } else { - // nothing to do + } else{ + drvid -= _app_driver_count; + if (drvid < BUILTIN_DRIVER_COUNT) { + driver = &_usbd_driver[drvid]; + } } + return driver; } |
