summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-09-27 09:47:24 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-09-27 11:09:23 +0200
commitbf03086f1aa66abd50d440db7895dfd535095e0c (patch)
tree69dfd27213efc25f32c949d49c913d9586b057a7
parent15af9fc8cc9e18409893d2375271d64cac76924a (diff)
downloadbarebox-bf03086f1aa66abd50d440db7895dfd535095e0c.tar.gz
barebox-bf03086f1aa66abd50d440db7895dfd535095e0c.tar.xz
usbgadget: autostart: Handle errors in file list gracefully
file_list_parse() can fail and returns an error pointer. Print an error message when it fails and also set to NULL again so that usb_multi_register() does not stumble upon the error pointer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/usb/gadget/autostart.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/usb/gadget/autostart.c b/drivers/usb/gadget/autostart.c
index 465d8fd380..3fa43137fa 100644
--- a/drivers/usb/gadget/autostart.c
+++ b/drivers/usb/gadget/autostart.c
@@ -11,6 +11,8 @@
* GNU General Public License for more details.
*
*/
+#define pr_fmt(fmt) "usbgadget autostart: " fmt
+
#include <common.h>
#include <command.h>
#include <errno.h>
@@ -42,8 +44,14 @@ static int usbgadget_autostart(void)
opts = xzalloc(sizeof(*opts));
opts->release = usb_multi_opts_release;
- if (fastboot_function)
+ if (fastboot_function) {
opts->fastboot_opts.files = file_list_parse(fastboot_function);
+ if (IS_ERR(opts->fastboot_opts.files)) {
+ pr_err("Parsing file list \"%s\" failed: %s\n", fastboot_function,
+ strerrorp(opts->fastboot_opts.files));
+ opts->fastboot_opts.files = NULL;
+ }
+ }
opts->create_acm = acm;