diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2015-12-11 16:06:19 +0100 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-12-20 19:40:30 -0800 |
commit | e2ffb77a14dbf6a8b47cfec750629ffc2b423e6e (patch) | |
tree | 82582ab46b26f31d412c1d62b1c9fc99f5086512 /drivers/usb/gadget | |
parent | c8afb616499e204440038556a5733338e215ce7f (diff) | |
download | linux-e2ffb77a14dbf6a8b47cfec750629ffc2b423e6e.tar.gz linux-e2ffb77a14dbf6a8b47cfec750629ffc2b423e6e.tar.bz2 linux-e2ffb77a14dbf6a8b47cfec750629ffc2b423e6e.zip |
usb: gadget: tcm: simplify attribute store function
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>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/legacy/tcm_usb_gadget.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/usb/gadget/legacy/tcm_usb_gadget.c b/drivers/usb/gadget/legacy/tcm_usb_gadget.c index 98064bbfc2a7..96b5d54b2a98 100644 --- a/drivers/usb/gadget/legacy/tcm_usb_gadget.c +++ b/drivers/usb/gadget/legacy/tcm_usb_gadget.c @@ -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) |