summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-09-27 09:55:46 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-09-27 11:09:31 +0200
commit9e6ddf343d61a6b2bb2a6dea8e4a34137a2978f9 (patch)
tree45ccb0dc3da9e29fe22d230a17fc1fdb0262c4ef
parentbc7e00c45bf479258f033a454e3c538d164c4ea5 (diff)
downloadbarebox-9e6ddf343d61a6b2bb2a6dea8e4a34137a2978f9.tar.gz
barebox-9e6ddf343d61a6b2bb2a6dea8e4a34137a2978f9.tar.xz
usbgadget: only set to peripheral mode when error checking is done
Only begin to modify the hardware when the obious errors have been checked. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/usb/gadget/autostart.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/gadget/autostart.c b/drivers/usb/gadget/autostart.c
index a27be899c3..2ca979057e 100644
--- a/drivers/usb/gadget/autostart.c
+++ b/drivers/usb/gadget/autostart.c
@@ -39,8 +39,6 @@ static int usbgadget_autostart(void)
if (!autostart)
return 0;
- setenv("otg.mode", "peripheral");
-
opts = xzalloc(sizeof(*opts));
opts->release = usb_multi_opts_release;
@@ -60,6 +58,8 @@ static int usbgadget_autostart(void)
return 0;
}
+ setenv("otg.mode", "peripheral");
+
ret = usb_multi_register(opts);
if (ret)
usb_multi_opts_release(opts);