public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cmd: dfu: Add error handling for board_usb_init
@ 2016-08-30 13:18 Michal Simek
  2016-08-31  4:29 ` Heiko Schocher
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Simek @ 2016-08-30 13:18 UTC (permalink / raw)
  To: u-boot

board_usb_init() can failed and error should be handled properly.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 common/dfu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/common/dfu.c b/common/dfu.c
index 4c529f7c36f9..e384873f66ed 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_REG_FAILURE;
+	}
 	g_dnl_clear_detach();
 	ret = g_dnl_register(usb_dnl_gadget);
 	if (ret) {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-31  4:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-30 13:18 [U-Boot] [PATCH] cmd: dfu: Add error handling for board_usb_init Michal Simek
2016-08-31  4:29 ` Heiko Schocher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox