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>
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);
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)