usb: xhci: (likely) fix bracket in if condition
Subsystems (2)
PATCH 1/1 usb: xhci: (likely) fix bracket in if condition
Because of the brackets the & and && is evaluated before the comparison. This is likely not the intention. Change it to test the first and second condition to both be true.
cc Marek Vasut <[email protected]>
Signed-off-by Jeroen Hofstee <[email protected]>
---
fixes a warning:
drivers/usb/host/xhci.c:647:32: warning: comparison of constant
2 with boolean expression is always false [-Wtautological-constant-out-of-range-compare]
le16_to_cpu(req->index)) > CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS) {
~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~NOT tested, wait for Marek to ack this!
--- drivers/usb/host/xhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/xhci.c +2 -2
@@ -643,8 +643,8 @@ static int xhci_submit_root(struct usb_device *udev, unsigned long pipe,struct xhci_ctrl *ctrl = udev->controller;struct xhci_hcor *hcor = ctrl->hcor; -if (((req->requesttype &USB_RT_PORT ) && -le16_to_cpu (req->index)) >CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS ) { +if ((req->requesttype &USB_RT_PORT ) && +le16_to_cpu (req->index) >CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS ) {printf ("The request port(%d) is not configured\n" ,le16_to_cpu (req->index) -1 );return -EINVAL ;
Signature · 1 line
1.8.3.2
Marek Vasut
AppliedPATCH 1/1 usb: xhci: (likely) fix bracket in if condition
Quoted 6 lines · Jeroen Hofstee
Because of the brackets the & and && is evaluated before the comparison. This is likely not the intention. Change it to test the first and second condition to both be true.
cc Marek Vasut <[email protected]>Signed-off-by Jeroen Hofstee <[email protected]>
Applied, thanks!
Best regards,
Marek Vasut