summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2015-12-11 16:06:15 +0100
committerNicholas Bellinger <nab@linux-iscsi.org>2015-12-20 19:40:21 -0800
commit894a2556e7691f87ee4b04e4a4b04a1814c572fa (patch)
treeeb736c13ba16d6bd2d2d4baa52528484daaf9357 /drivers/usb
parent4fef4e43558af8e880356c2893616bcee8b32867 (diff)
downloadlinux-894a2556e7691f87ee4b04e4a4b04a1814c572fa.tar.bz2
tcm_usb_gadget: Fix enabled attribute failure
Fix up tcm_usbg_tpg_store_enable() return value to propagate usbg_attach() failure up to user-space if no HDC is found. Reported-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> 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')
-rw-r--r--drivers/usb/gadget/legacy/tcm_usb_gadget.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/usb/gadget/legacy/tcm_usb_gadget.c b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
index e90d3c917e0b..65e49504d1ac 100644
--- a/drivers/usb/gadget/legacy/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/legacy/tcm_usb_gadget.c
@@ -1505,10 +1505,14 @@ static ssize_t tcm_usbg_tpg_enable_store(struct config_item *item,
if (op > 1)
return -EINVAL;
- if (op && tpg->gadget_connect)
+ if (op && tpg->gadget_connect) {
+ ret = -EINVAL;
goto out;
- if (!op && !tpg->gadget_connect)
+ }
+ if (!op && !tpg->gadget_connect) {
+ ret = -EINVAL;
goto out;
+ }
if (op) {
ret = usbg_attach(tpg);
@@ -1518,8 +1522,10 @@ static ssize_t tcm_usbg_tpg_enable_store(struct config_item *item,
usbg_detach(tpg);
}
tpg->gadget_connect = op;
-out:
+
return count;
+out:
+ return ret;
}
static ssize_t tcm_usbg_tpg_nexus_show(struct config_item *item, char *page)