[U-Boot] [PATCH v2] cmd: dfu: Add error handling for board_usb_init

Lukasz Majewski l.majewski at samsung.com
Tue Aug 30 16:18:06 CEST 2016


Hi Michal,

> board_usb_init() can failed and error should be handled properly.
> 
> Signed-off-by: Michal Simek <michal.simek at xilinx.com>
> ---
> 
> Changes in v2:
> - Fix type in return error value
> 
>  common/dfu.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/common/dfu.c b/common/dfu.c
> index 4c529f7c36f9..0e9f5f59c80a 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) {

Acked-by: Lukasz Majewski <l.majewski at samsung.com>

Thanks for the patch.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group


More information about the U-Boot mailing list