Browse Source

USB: inode.c: move assignment out of if () block

We should not be doing assignments within an if () block
so fix up the code to not do this.

change was created using Coccinelle.

CC: Al Viro <viro@zeniv.linux.org.uk>
CC: Peter Chen <peter.chen@freescale.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
CC: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
CC: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Greg Kroah-Hartman 10 years ago
parent
commit
1ee7eead70
1 changed files with 6 additions and 3 deletions
  1. 6 3
      drivers/usb/gadget/legacy/inode.c

+ 6 - 3
drivers/usb/gadget/legacy/inode.c

@@ -769,9 +769,12 @@ ep_config (struct ep_data *data, const char *buf, size_t len)
 	if (data->dev->state == STATE_DEV_UNBOUND) {
 		value = -ENOENT;
 		goto gone;
-	} else if ((ep = data->ep) == NULL) {
-		value = -ENODEV;
-		goto gone;
+	} else {
+		ep = data->ep;
+		if (ep == NULL) {
+			value = -ENODEV;
+			goto gone;
+		}
 	}
 	switch (data->dev->gadget->speed) {
 	case USB_SPEED_LOW: