From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko Schocher Date: Wed, 31 Aug 2016 06:30:09 +0200 Subject: [U-Boot] [PATCH v2] cmd: dfu: Add error handling for board_usb_init In-Reply-To: <68d18850f13cda008b0fd31c521c9682bab664e2.1472563934.git.michal.simek@xilinx.com> References: <68d18850f13cda008b0fd31c521c9682bab664e2.1472563934.git.michal.simek@xilinx.com> Message-ID: <57C65D51.80604@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Michal, Am 30.08.2016 um 15:32 schrieb Michal Simek: > board_usb_init() can failed and error should be handled properly. > > Signed-off-by: Michal Simek > --- > > Changes in v2: > - Fix type in return error value > > common/dfu.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) Reviewed-by: Heiko Schocher bye, Heiko > > 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) { > -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany