diff options
author | Sanchayan Maity <maitysanchayan@gmail.com> | 2016-08-08 14:26:17 +0300 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2016-09-28 00:30:22 +0300 |
commit | 54a708ca06830c3fe3df8c0001ab33df784701f9 (patch) | |
tree | 86d6d1d1660ae6851260fc4c25437ec66b95017e | |
parent | cdb1808aefbc7173d687cb03de15b8ee3a671743 (diff) | |
download | u-boot-54a708ca06830c3fe3df8c0001ab33df784701f9.tar.xz |
cmd: dfu: Add error handling for failed registration
Without this, if g_dnl_register() fails, DFU code continues on
blindly and crashes. This fix makes it simply print an error
message instead.
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
[l.majewski@samsung.com - some manual tweaks needed]
-rw-r--r-- | common/dfu.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/common/dfu.c b/common/dfu.c index 14b60f1fbb..4c529f7c36 100644 --- a/common/dfu.c +++ b/common/dfu.c @@ -26,7 +26,12 @@ int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget) board_usb_init(usbctrl_index, USB_INIT_DEVICE); g_dnl_clear_detach(); - g_dnl_register(usb_dnl_gadget); + ret = g_dnl_register(usb_dnl_gadget); + if (ret) { + error("g_dnl_register failed"); + return CMD_RET_FAILURE; + } + while (1) { if (g_dnl_detach()) { /* |