summaryrefslogtreecommitdiff
path: root/common/dfu.c
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2016-08-30 15:32:17 +0200
committerMarek Vasut <marex@denx.de>2016-11-03 11:55:25 +0100
commitdbdc2744ee69ae9eb02bebac87e66c8f2f3ad795 (patch)
treea360535645f1da8277e52252ab880199ce23e027 /common/dfu.c
parentd8bdfc80da39211d95f10d24e79f2e867305f71b (diff)
downloadu-boot-imx-dbdc2744ee69ae9eb02bebac87e66c8f2f3ad795.zip
u-boot-imx-dbdc2744ee69ae9eb02bebac87e66c8f2f3ad795.tar.gz
u-boot-imx-dbdc2744ee69ae9eb02bebac87e66c8f2f3ad795.tar.bz2
cmd: dfu: Add error handling for board_usb_init
board_usb_init() can failed and error should be handled properly. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'common/dfu.c')
-rw-r--r--common/dfu.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/common/dfu.c b/common/dfu.c
index 4c529f7..0e9f5f5 100644
--- a/common/dfu.c
+++ b/common/dfu.c
@@ -24,7 +24,11 @@ int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget)
bool dfu_reset = false;
int ret, i = 0;
- board_usb_init(usbctrl_index, USB_INIT_DEVICE);
+ ret = board_usb_init(usbctrl_index, USB_INIT_DEVICE);
+ if (ret) {
+ error("board usb init failed\n");
+ return CMD_RET_FAILURE;
+ }
g_dnl_clear_detach();
ret = g_dnl_register(usb_dnl_gadget);
if (ret) {