linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [patch] usb: gadget: fsl_qe_udc: signedness bug in qe_get_frame()
@ 2016-07-15 11:15 Dan Carpenter
  2016-07-18  1:50 ` Peter Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-07-15 11:15 UTC (permalink / raw)
  To: Li Yang
  Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, linuxppc-dev,
	kernel-janitors

We can't assign -EINVAL to a u16.

Fixes: 3948f0e0c999 ('usb: add Freescale QE/CPM USB peripheral controller driver')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c
index 93d28cb..901366f 100644
--- a/drivers/usb/gadget/udc/fsl_qe_udc.c
+++ b/drivers/usb/gadget/udc/fsl_qe_udc.c
@@ -1878,11 +1878,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,

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-18  1:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-15 11:15 [patch] usb: gadget: fsl_qe_udc: signedness bug in qe_get_frame() Dan Carpenter
2016-07-18  1:50 ` Peter Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).