usb: gadget: fsl_qe_udc: signedness bug in qe_get_frame()
[pandora-kernel.git] / drivers / usb / gadget / fsl_qe_udc.c
index 3bf872e..4e2b5a9 100644 (file)
@@ -540,7 +540,7 @@ static int qe_ep_init(struct qe_udc *udc,
        int reval = 0;
        u16 max = 0;
 
-       max = le16_to_cpu(desc->wMaxPacketSize);
+       max = usb_endpoint_maxp(desc);
 
        /* check the max package size validate for this endpoint */
        /* Refer to USB2.0 spec table 9-13,
@@ -1883,11 +1883,8 @@ static int qe_get_frame(struct usb_gadget *gadget)
 
        tmp = in_be16(&udc_controller->usb_param->frame_n);
        if (tmp & 0x8000)
-               tmp = tmp & 0x07ff;
-       else
-               tmp = -EINVAL;
-
-       return (int)tmp;
+               return tmp & 0x07ff;
+       return -EINVAL;
 }
 
 /* Tries to wake up the host connected to this gadget
@@ -2336,8 +2333,7 @@ static int fsl_qe_start(struct usb_gadget_driver *driver,
        if (!udc_controller)
                return -ENODEV;
 
-       if (!driver || (driver->speed != USB_SPEED_FULL
-                       && driver->speed != USB_SPEED_HIGH)
+       if (!driver || driver->speed < USB_SPEED_FULL
                        || !bind || !driver->disconnect || !driver->setup)
                return -EINVAL;