Commit 894a2556 authored by Nicholas Bellinger's avatar Nicholas Bellinger

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: default avatarAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: default avatarAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 4fef4e43
...@@ -1505,10 +1505,14 @@ static ssize_t tcm_usbg_tpg_enable_store(struct config_item *item, ...@@ -1505,10 +1505,14 @@ static ssize_t tcm_usbg_tpg_enable_store(struct config_item *item,
if (op > 1) if (op > 1)
return -EINVAL; return -EINVAL;
if (op && tpg->gadget_connect) if (op && tpg->gadget_connect) {
ret = -EINVAL;
goto out; goto out;
if (!op && !tpg->gadget_connect) }
if (!op && !tpg->gadget_connect) {
ret = -EINVAL;
goto out; goto out;
}
if (op) { if (op) {
ret = usbg_attach(tpg); ret = usbg_attach(tpg);
...@@ -1518,8 +1522,10 @@ static ssize_t tcm_usbg_tpg_enable_store(struct config_item *item, ...@@ -1518,8 +1522,10 @@ static ssize_t tcm_usbg_tpg_enable_store(struct config_item *item,
usbg_detach(tpg); usbg_detach(tpg);
} }
tpg->gadget_connect = op; tpg->gadget_connect = op;
out:
return count; return count;
out:
return ret;
} }
static ssize_t tcm_usbg_tpg_nexus_show(struct config_item *item, char *page) static ssize_t tcm_usbg_tpg_nexus_show(struct config_item *item, char *page)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment