Skip to contentSkip to conversation

usb: usb251xb: remove >=0 check for u32 port

PATCH Applied Rouven Czerwinski 2 participants 2 messages Jun 17, 2021 – Jun 21, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: usb251xb: remove >=0 check for u32 port

The compiler rightfully complains:

drivers/usb/misc/usb251xb.c: In function ‘usb251xb_get_ofdata’:
drivers/usb/misc/usb251xb.c:563:13: warning: comparison of unsigned expression in ‘>= 0’ is always true [-Wtype-limits]

    563 |   if ((port >= 0) && (port <= data->port_cnt))

so drop the check.

---
 drivers/usb/misc/usb251xb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/misc/usb251xb.c +1 -1
index 10d5aa310b..e282988fb4 100644
@@ -560,7 +560,7 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
 	 */
 	hub->port_swap = USB251XB_DEF_PORT_SWAP;
 	of_property_for_each_u32(np, "swap-dx-lanes", prop, p, port) {
-		if ((port >= 0) && (port <= data->port_cnt))
+		if (port <= data->port_cnt)
 			hub->port_swap |= BIT(port);
 	}
 
Signature · 7 lines
2.31.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#1 lore raw
Quoted 4 lines · Rouven Czerwinski

The compiler rightfully complains:

drivers/usb/misc/usb251xb.c: In function ‘usb251xb_get_ofdata’:
drivers/usb/misc/usb251xb.c:563:13: warning: comparison of unsigned expression in ‘>= 0’ is always true [-Wtype-limits]

Quoted 8 lines
    563 |   if ((port >= 0) && (port <= data->port_cnt))

so drop the check.

---
 drivers/usb/misc/usb251xb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox