[PATCH 07/22] usb: core: remove unnecessary comparison
Ahmad Fatoum
a.fatoum at pengutronix.de
Thu Mar 13 00:34:30 PDT 2025
The GCC default is to treat enums without negative values in the
enumerations as an unsigned int. clang seems to follow suit and
clang-analyzer warns that speed < 0 can never happen.
Therefore, drop this superfluous check.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/usb/core/common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/core/common.c b/drivers/usb/core/common.c
index 61ccc130244b..f255f97cdd4d 100644
--- a/drivers/usb/core/common.c
+++ b/drivers/usb/core/common.c
@@ -13,7 +13,7 @@ static const char *const speed_names[] = {
const char *usb_speed_string(enum usb_device_speed speed)
{
- if (speed < 0 || speed >= ARRAY_SIZE(speed_names))
+ if (speed >= ARRAY_SIZE(speed_names))
speed = USB_SPEED_UNKNOWN;
return speed_names[speed];
}
--
2.39.5
More information about the barebox
mailing list