Browse Source

usb: gadget: f_printer: use non-zero flag for bitwise and

USB_DIR_OUT happens to be zero, so the result of bitwise and is always 0.
Consequently, break will never happen in the SOFT_RESET case.
This patch uses a compatible condition with a non-zero USB_DIR_IN,
which might or might not evaluate to zero.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Andrzej Pietrasiewicz 10 years ago
parent
commit
fbdecad99c
1 changed files with 1 additions and 1 deletions
  1. 1 1
      drivers/usb/gadget/function/f_printer.c

+ 1 - 1
drivers/usb/gadget/function/f_printer.c

@@ -918,7 +918,7 @@ static bool gprinter_req_match(struct usb_function *f,
 		return false;
 	case SOFT_RESET:
 		if (!w_value && !w_length &&
-		   (USB_DIR_OUT & ctrl->bRequestType))
+		   !(USB_DIR_IN & ctrl->bRequestType))
 			break;
 		/* fall through */
 	default: