From 935068a130dae941bb5abed0249fbe7e033f8d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Szewczyk?= Date: Thu, 15 Mar 2018 18:51:51 +0100 Subject: usb: Assign new functions to legacy gadget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I86df0d0db29813781c8b49dc111f726b24b82041 Signed-off-by: Paweł Szewczyk --- hw/usb_client/usb_client.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/usb_client/usb_client.c b/hw/usb_client/usb_client.c index 824e562..0f1effe 100644 --- a/hw/usb_client/usb_client.c +++ b/hw/usb_client/usb_client.c @@ -278,6 +278,7 @@ static int legacy_read_config(struct usb_gadget *gadget, char *sep = LEGACY_FUNC_SEP; int i, f_cnt; int f_idx; + int g_f_idx; int ret; ret = sys_get_str(cpath, buf, sizeof(buf)); @@ -301,6 +302,8 @@ static int legacy_read_config(struct usb_gadget *gadget, if (ret) return ret; + for (g_f_idx = 0; gadget->funcs[g_f_idx]; ++g_f_idx); + f_idx = 0; for (fname = strsep(&begin, sep); fname; fname = strsep(&begin, sep)) { struct usb_function *func; @@ -311,6 +314,8 @@ static int legacy_read_config(struct usb_gadget *gadget, ret = legacy_alloc_new_func(gadget, fname, &func); if (ret) goto free_config; + + gadget->funcs[g_f_idx++] = func; } config->funcs[f_idx++] = func; -- cgit v1.2.3