[ You're actually innocent, but the warning is marked as new when the
code moved around. Anyway maybe you know the answer. -dan ]
Hello Andrzej Pietrasiewicz,
The patch b185f01a9ab7: "usb: gadget: printer: factor out f_printer"
from Mar 3, 2015, leads to the following static checker warning:
drivers/usb/gadget/function/f_printer.c:921 gprinter_req_match()
warn: bitwise AND condition is false here
drivers/usb/gadget/function/f_printer.c
895 static bool gprinter_req_match(struct usb_function *f,
896 const struct usb_ctrlrequest *ctrl)
897 {
898 struct printer_dev *dev = func_to_printer(f);
899 u16 w_index = le16_to_cpu(ctrl->wIndex);
900 u16 w_value = le16_to_cpu(ctrl->wValue);
901 u16 w_length = le16_to_cpu(ctrl->wLength);
902
903 if ((ctrl->bRequestType & USB_RECIP_MASK) !=
USB_RECIP_INTERFACE ||
904 (ctrl->bRequestType & USB_TYPE_MASK) != USB_TYPE_CLASS)
905 return false;
906
907 switch (ctrl->bRequest) {
908 case GET_DEVICE_ID:
909 w_index >>= 8;
910 if (w_length <= PNP_STRING_LEN &&
911 (USB_DIR_IN & ctrl->bRequestType))
912 break;
913 return false;
914 case GET_PORT_STATUS:
915 if (!w_value && w_length == 1 &&
916 (USB_DIR_IN & ctrl->bRequestType))
917 break;
918 return false;
919 case SOFT_RESET:
920 if (!w_value && !w_length &&
921 (USB_DIR_OUT & ctrl->bRequestType))
^^^^^^^^^^^
USB_DIR_OUT is zero so we will never break here. I'm not sure what was
intended.
922 break;
923 /* fall through */
924 default:
925 return false;
926 }
927 return w_index == dev->interface;
928 }
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html