]> git.itanic.dy.fi Git - linux-stable/commitdiff
usb: gadget: fsl_qe_udc: signedness bug in qe_get_frame()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 15 Jul 2016 11:15:47 +0000 (14:15 +0300)
committerJiri Slaby <jslaby@suse.cz>
Fri, 7 Oct 2016 08:06:48 +0000 (10:06 +0200)
commit f4693b08cc901912a87369c46537b94ed4084ea0 upstream.

We can't assign -EINVAL to a u16.

Fixes: 3948f0e0c999 ('usb: add Freescale QE/CPM USB peripheral controller driver')
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/usb/gadget/fsl_qe_udc.c

index f3bb363f1d4acffd04d028c7940f70ff594e4ab5..9d81d390e124cb861730546953d1be09d70ec1d7 100644 (file)
@@ -1881,11 +1881,8 @@ static int qe_get_frame(struct usb_gadget *gadget)
 
        tmp = in_be16(&udc->usb_param->frame_n);
        if (tmp & 0x8000)
-               tmp = tmp & 0x07ff;
-       else
-               tmp = -EINVAL;
-
-       return (int)tmp;
+               return tmp & 0x07ff;
+       return -EINVAL;
 }
 
 static int fsl_qe_start(struct usb_gadget *gadget,