diff options
Diffstat (limited to 'hw/usb_gadget_common.c')
-rw-r--r-- | hw/usb_gadget_common.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/hw/usb_gadget_common.c b/hw/usb_gadget_common.c index 17393ec..c27d065 100644 --- a/hw/usb_gadget_common.c +++ b/hw/usb_gadget_common.c @@ -34,17 +34,10 @@ static struct usb_function *_available_funcs[]; static void simple_cleanup_config(struct usb_configuration *config) { - int i; - if (!config) return; - if (config->strs) { - for (i = 0; config->strs[i].lang_code; ++i) - free(config->strs[i].config_str); - - free(config->strs); - } + free(config->strs.config_str); if (config->funcs) free(config->funcs); @@ -82,23 +75,16 @@ static int alloc_default_config(struct usb_configuration **_config) config = calloc(1, sizeof(*config)); if (!config) - goto out; - - config->strs = calloc(1, sizeof(*config->strs)); - if (!config->strs) - goto free_config; + return -ENOMEM; config->attrs.bmAttributs = DEFAULT_BMATTRIBUTES; config->attrs.MaxPower = DEFAULT_MAX_POWER; + /* TODO. Here is where to set the string used in config of configfs */ + *_config = config; return 0; - -free_config: - free(config); -out: - return -ENOMEM; } static int get_device_serial(char **out) |