Commit edc69d55 authored by Michal Nazarewicz's avatar Michal Nazarewicz Committed by Felipe Balbi

usb: gadget: mv_udc: clarify a switch with an implicit fall-through

Rearrange statements in mv_ep_enable function so that it’s obvious
what the switch does and how zlt, ios and mult variables are
initialised.  Most notably, this gets rid of an implicit fall-through
so people don’t have to wonder whether it was intenional or not.

Addresses-Coverity-ID: 201385
Reported-by: default avatarGustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: default avatarMichal Nazarewicz <mina86@mina86.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 1966b865
...@@ -445,7 +445,8 @@ static int mv_ep_enable(struct usb_ep *_ep, ...@@ -445,7 +445,8 @@ static int mv_ep_enable(struct usb_ep *_ep,
struct mv_dqh *dqh; struct mv_dqh *dqh;
u16 max = 0; u16 max = 0;
u32 bit_pos, epctrlx, direction; u32 bit_pos, epctrlx, direction;
unsigned char zlt = 0, ios = 0, mult = 0; const unsigned char zlt = 1;
unsigned char ios, mult;
unsigned long flags; unsigned long flags;
ep = container_of(_ep, struct mv_ep, ep); ep = container_of(_ep, struct mv_ep, ep);
...@@ -465,8 +466,6 @@ static int mv_ep_enable(struct usb_ep *_ep, ...@@ -465,8 +466,6 @@ static int mv_ep_enable(struct usb_ep *_ep,
* disable HW zero length termination select * disable HW zero length termination select
* driver handles zero length packet through req->req.zero * driver handles zero length packet through req->req.zero
*/ */
zlt = 1;
bit_pos = 1 << ((direction == EP_DIR_OUT ? 0 : 16) + ep->ep_num); bit_pos = 1 << ((direction == EP_DIR_OUT ? 0 : 16) + ep->ep_num);
/* Check if the Endpoint is Primed */ /* Check if the Endpoint is Primed */
...@@ -481,16 +480,16 @@ static int mv_ep_enable(struct usb_ep *_ep, ...@@ -481,16 +480,16 @@ static int mv_ep_enable(struct usb_ep *_ep,
(unsigned)bit_pos); (unsigned)bit_pos);
goto en_done; goto en_done;
} }
/* Set the max packet length, interrupt on Setup and Mult fields */ /* Set the max packet length, interrupt on Setup and Mult fields */
ios = 0;
mult = 0;
switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) { switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
case USB_ENDPOINT_XFER_BULK: case USB_ENDPOINT_XFER_BULK:
zlt = 1; case USB_ENDPOINT_XFER_INT:
mult = 0;
break; break;
case USB_ENDPOINT_XFER_CONTROL: case USB_ENDPOINT_XFER_CONTROL:
ios = 1; ios = 1;
case USB_ENDPOINT_XFER_INT:
mult = 0;
break; break;
case USB_ENDPOINT_XFER_ISOC: case USB_ENDPOINT_XFER_ISOC:
/* Calculate transactions needed for high bandwidth iso */ /* Calculate transactions needed for high bandwidth iso */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment