diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-13 08:16:44 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-13 08:16:44 +0100 |
commit | 6b926567c0cfd360d7ab8bedc3745610eda379bd (patch) | |
tree | 2fb531e8d1ab89c3ae0fd349c1717564841a784c /commands | |
parent | a2e3bad25f6033e35e7a0f729cbd164d2d079c17 (diff) | |
parent | 2b9bcff79a02f770fa730e2689ba35cc03c0da7d (diff) | |
download | barebox-6b926567c0cfd360d7ab8bedc3745610eda379bd.tar.gz barebox-6b926567c0cfd360d7ab8bedc3745610eda379bd.tar.xz |
Merge branch 'for-next/usb'
Diffstat (limited to 'commands')
-rw-r--r-- | commands/usbgadget.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/commands/usbgadget.c b/commands/usbgadget.c index a7e8d6c0c3..314884aee8 100644 --- a/commands/usbgadget.c +++ b/commands/usbgadget.c @@ -31,10 +31,10 @@ static int do_usbgadget(int argc, char *argv[]) { - int opt; + int opt, ret; int acm = 1, create_serial = 0; char *fastboot_opts = NULL, *dfu_opts = NULL; - struct f_multi_opts opts = {}; + struct f_multi_opts *opts; while ((opt = getopt(argc, argv, "asdA:D:")) > 0) { switch (opt) { @@ -73,19 +73,26 @@ static int do_usbgadget(int argc, char *argv[]) return -EINVAL; } + opts = xzalloc(sizeof(*opts)); + opts->release = usb_multi_opts_release; + if (fastboot_opts) { - opts.fastboot_opts.files = file_list_parse(fastboot_opts); + opts->fastboot_opts.files = file_list_parse(fastboot_opts); } if (dfu_opts) { - opts.dfu_opts.files = file_list_parse(dfu_opts); + opts->dfu_opts.files = file_list_parse(dfu_opts); } if (create_serial) { - opts.create_acm = acm; + opts->create_acm = acm; } - return usb_multi_register(&opts); + ret = usb_multi_register(opts); + if (ret) + usb_multi_opts_release(opts); + + return ret; } BAREBOX_CMD_HELP_START(usbgadget) |