usb: fix yellow in eb69211791
rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
| Newsgroups | gmane.comp.systems.archos.rockbox.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit b349eea2c9d710a00e4f609be692e75542d84d51 Author: Solomon Peachy <[email protected]> Date: Tue Jan 27 15:19:55 2026 -0500 usb: fix yellow in eb69211791 Bootloaders with HAVE_USBSTACK but without HAVE_BOOTLOADER_USB_MODE end up with USB_NUM_DRIVERS of 0 which leads to a warning due to a signed number being checked to see if it's >= 0. Work around this temporarily; the proper fix is to not build usb_core and its class drivers when BOOTLOADER & !HAVE_BOOTLOADER_USB_MODE Change-Id: I1b41140d31ba9df6b4c760478c4265d4e5584963 diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c index 60d07879ef..9d5fa04d13 100644 --- a/firmware/usbstack/usb_core.c +++ b/firmware/usbstack/usb_core.c @@ -1182,8 +1182,12 @@ void usb_core_handle_notify(long id, intptr_t data) #endif break; case USB_NOTIFY_CLASS_DRIVER: { - uint8_t index = data >> 24; - if(index >= USB_NUM_DRIVERS) { + /* HACK: index is uint8 but promoted to int to avoid a compiler + warning when USB_NUM_DRIVERS is 0, mainly in bootloaders. + This hack can be removed once usb_core is no longer built + for BOOTLOADER && !HAVE_BOOTLOADER_USB_MODE */ + int index = data >> 24; + if(index < 0 || index >= USB_NUM_DRIVERS) { logf("usb_core: invalid notification destination index=%u", index); return; } -- rockbox-cvs mailing list [email protected] https://lists.haxx.se/mailman/listinfo/rockbox-cvs