]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
usb: gadget: tcm: simplify attribute store function
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Fri, 11 Dec 2015 15:06:19 +0000 (16:06 +0100)
committerNicholas Bellinger <nab@linux-iscsi.org>
Mon, 21 Dec 2015 03:40:30 +0000 (19:40 -0800)
Simplify function code.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/usb/gadget/legacy/tcm_usb_gadget.c

index 98064bbfc2a756786f0c9ee19d287e33c825fedd..96b5d54b2a9800b3c4aa5d74ceeeb6f0b9abad60 100644 (file)
@@ -1503,27 +1503,19 @@ static ssize_t tcm_usbg_tpg_enable_store(struct config_item *item,
        if (ret)
                return ret;
 
-       if (op && tpg->gadget_connect) {
-               ret = -EINVAL;
-               goto out;
-       }
-       if (!op && !tpg->gadget_connect) {
-               ret = -EINVAL;
-               goto out;
-       }
+       if ((op && tpg->gadget_connect) || (!op && !tpg->gadget_connect))
+               return -EINVAL;
 
-       if (op) {
+       if (op)
                ret = usbg_attach(tpg);
-               if (ret)
-                       goto out;
-       } else {
+       else
                usbg_detach(tpg);
-       }
+       if (ret)
+               return ret;
+
        tpg->gadget_connect = op;
 
        return count;
-out:
-       return ret;
 }
 
 static ssize_t tcm_usbg_tpg_nexus_show(struct config_item *item, char *page)