From: Andrzej Pietrasiewicz Date: Fri, 13 Mar 2015 10:08:08 +0000 (+0100) Subject: usb: gadget: f_printer: use non-zero flag for bitwise and X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fbdecad99c3f37346ed868fec0c3a9c2809f78e9;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c index 48882ecf1610..44173df27273 100644 --- a/drivers/usb/gadget/function/f_printer.c +++ b/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: