From: Nicholas Bellinger <n...@linux-iscsi.org> 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 <andrze...@samsung.com> Cc: Andrzej Pietrasiewicz <andrze...@samsung.com> Cc: Sebastian Andrzej Siewior <bige...@linutronix.de> Signed-off-by: Nicholas Bellinger <n...@linux-iscsi.org> [split unrelated changes into separate patches] Signed-off-by: Andrzej Pietrasiewicz <andrze...@samsung.com> --- drivers/usb/gadget/legacy/tcm_usb_gadget.c | 12 +++++++++--- 1 file 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 e90d3c9..65e4950 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) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html