Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andrzej Pietrasiewicz and committed by
Nicholas Bellinger
e2ffb77a c8afb616

+7 -15
+7 -15
drivers/usb/gadget/legacy/tcm_usb_gadget.c
··· 1503 1503 if (ret) 1504 1504 return ret; 1505 1505 1506 - if (op && tpg->gadget_connect) { 1507 - ret = -EINVAL; 1508 - goto out; 1509 - } 1510 - if (!op && !tpg->gadget_connect) { 1511 - ret = -EINVAL; 1512 - goto out; 1513 - } 1506 + if ((op && tpg->gadget_connect) || (!op && !tpg->gadget_connect)) 1507 + return -EINVAL; 1514 1508 1515 - if (op) { 1509 + if (op) 1516 1510 ret = usbg_attach(tpg); 1517 - if (ret) 1518 - goto out; 1519 - } else { 1511 + else 1520 1512 usbg_detach(tpg); 1521 - } 1513 + if (ret) 1514 + return ret; 1515 + 1522 1516 tpg->gadget_connect = op; 1523 1517 1524 1518 return count; 1525 - out: 1526 - return ret; 1527 1519 } 1528 1520 1529 1521 static ssize_t tcm_usbg_tpg_nexus_show(struct config_item *item, char *page)