]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cmd: dfu: Add error handling for board_usb_init
authorMichal Simek <michal.simek@xilinx.com>
Tue, 30 Aug 2016 13:32:17 +0000 (15:32 +0200)
committerMarek Vasut <marex@denx.de>
Thu, 3 Nov 2016 10:55:25 +0000 (11:55 +0100)
board_usb_init() can failed and error should be handled properly.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
common/dfu.c

index 4c529f7c36f909a2797b92478653aa2bbde6899d..0e9f5f59c80a6a597eefada2c66d80c85d1bc6fa 100644 (file)
@@ -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) {