All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] usb: xhci: (likely) fix bracket in if condition
@ 2014-06-11 22:31 Jeroen Hofstee
  2014-06-25 20:43 ` Marek Vasut
  0 siblings, 1 reply; 2+ messages in thread
From: Jeroen Hofstee @ 2014-06-11 22:31 UTC (permalink / raw)
  To: u-boot

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 <marex@denx.de>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

---
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(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index d1c2e5c..59dc096 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -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;
-- 
1.8.3.2

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

* [U-Boot] [PATCH] usb: xhci: (likely) fix bracket in if condition
  2014-06-11 22:31 [U-Boot] [PATCH] usb: xhci: (likely) fix bracket in if condition Jeroen Hofstee
@ 2014-06-25 20:43 ` Marek Vasut
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Vasut @ 2014-06-25 20:43 UTC (permalink / raw)
  To: u-boot

On Thursday, June 12, 2014 at 12:31:27 AM, Jeroen Hofstee wrote:
> 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 <marex@denx.de>
> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

Applied, thanks!

Best regards,
Marek Vasut

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

end of thread, other threads:[~2014-06-25 20:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-11 22:31 [U-Boot] [PATCH] usb: xhci: (likely) fix bracket in if condition Jeroen Hofstee
2014-06-25 20:43 ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.