mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] usb: usb251xb: remove >=0 check for u32 port
@ 2021-06-17 17:00 Rouven Czerwinski
  2021-06-21  4:34 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Rouven Czerwinski @ 2021-06-17 17:00 UTC (permalink / raw)
  To: barebox; +Cc: 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]
    563 |   if ((port >= 0) && (port <= data->port_cnt))

so drop the check.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 drivers/usb/misc/usb251xb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
index 10d5aa310b..e282988fb4 100644
--- a/drivers/usb/misc/usb251xb.c
+++ b/drivers/usb/misc/usb251xb.c
@@ -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);
 	}
 
-- 
2.31.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: usb251xb: remove >=0 check for u32 port
  2021-06-17 17:00 [PATCH] usb: usb251xb: remove >=0 check for u32 port Rouven Czerwinski
@ 2021-06-21  4:34 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2021-06-21  4:34 UTC (permalink / raw)
  To: Rouven Czerwinski; +Cc: barebox

On Thu, Jun 17, 2021 at 07:00:19PM +0200, Rouven Czerwinski wrote:
> 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.
> 
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
>  drivers/usb/misc/usb251xb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Sascha

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-21  4:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17 17:00 [PATCH] usb: usb251xb: remove >=0 check for u32 port Rouven Czerwinski
2021-06-21  4:34 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox