summaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-11-07 14:04:58 +0700
committerhathach <[email protected]>2025-11-07 23:50:16 +0700
commit652342b57b129a79e0df152377d18096e4a0fed5 (patch)
tree89b5cde09ecc608176a68acf1dd93e73a3e141c6 /src/device
parent86a4990b96eafb5904f946fa061b310f155a7d51 (diff)
fix more alerts found by pvs-studio
Diffstat (limited to 'src/device')
-rw-r--r--src/device/usbd.c10
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;
}