diff options
author | Rouven Czerwinski <r.czerwinski@pengutronix.de> | 2021-08-10 07:29:27 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-10-05 09:03:39 +0200 |
commit | 4b1b73661ffa970aba2d551aaa4353407d93ff85 (patch) | |
tree | 4fe986145be9f237ce4ab52f3389b1d079b33611 /common/usbgadget.c | |
parent | 032727c039f296ba3f5865cd37e52bf947bc460e (diff) | |
download | barebox-4b1b73661ffa970aba2d551aaa4353407d93ff85.tar.gz barebox-4b1b73661ffa970aba2d551aaa4353407d93ff85.tar.xz |
file_list: add file_list_parse_null()
Move the usbgadget parse() function to file_list and rename it to
file_list_parse_null() which will return a NULL pointer instead of an
error. Also adjust the callers in the usbgadget code.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Link: https://lore.barebox.org/20210810052928.101783-1-r.czerwinski@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/usbgadget.c')
-rw-r--r-- | common/usbgadget.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/common/usbgadget.c b/common/usbgadget.c index 34a685234b..e8c9f7d236 100644 --- a/common/usbgadget.c +++ b/common/usbgadget.c @@ -23,26 +23,10 @@ static int autostart; static int acm; static char *dfu_function; -static struct file_list *parse(const char *files) -{ - struct file_list *list; - - if (!files) - return NULL; - - list = file_list_parse(files); - if (IS_ERR(list)) { - pr_err("Parsing file list \"%s\" failed: %pe\n", files, list); - return NULL; - } - - return list; -} - static inline struct file_list *get_dfu_function(void) { if (dfu_function && *dfu_function) - return file_list_parse(dfu_function); + return file_list_parse_null(dfu_function); if (!system_partitions_empty()) return system_partitions_get(); return NULL; @@ -59,7 +43,7 @@ int usbgadget_register(const struct usbgadget_funcs *funcs) opts->release = usb_multi_opts_release; if (flags & USBGADGET_DFU) { - opts->dfu_opts.files = parse(funcs->dfu_opts); + opts->dfu_opts.files = file_list_parse_null(funcs->dfu_opts); if (IS_ENABLED(CONFIG_USB_GADGET_DFU) && file_list_empty(opts->dfu_opts.files)) { file_list_free(opts->dfu_opts.files); opts->dfu_opts.files = get_dfu_function(); @@ -67,7 +51,7 @@ int usbgadget_register(const struct usbgadget_funcs *funcs) } if (flags & USBGADGET_MASS_STORAGE) { - opts->ums_opts.files = parse(funcs->ums_opts); + opts->ums_opts.files = file_list_parse_null(funcs->ums_opts); if (IS_ENABLED(CONFIG_USB_GADGET_MASS_STORAGE) && file_list_empty(opts->ums_opts.files)) { file_list_free(opts->ums_opts.files); opts->ums_opts.files = system_partitions_get(); @@ -75,7 +59,7 @@ int usbgadget_register(const struct usbgadget_funcs *funcs) } if (flags & USBGADGET_FASTBOOT) { - opts->fastboot_opts.files = parse(funcs->fastboot_opts); + opts->fastboot_opts.files = file_list_parse_null(funcs->fastboot_opts); if (IS_ENABLED(CONFIG_FASTBOOT_BASE) && file_list_empty(opts->fastboot_opts.files)) { file_list_free(opts->fastboot_opts.files); opts->fastboot_opts.files = get_fastboot_partitions(); |