diff options
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2019-06-04 21:01:55 +0200 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2019-06-14 12:39:50 +0200 |
commit | 25ee924649f94b42fba8ef615b5eb39db19044cd (patch) | |
tree | d2834e951d31eaaf25f3fcbd2673b46409e4b7cf /cmd/usb_gadget_sdp.c | |
parent | 634931fea542fc59cf7537b6c2c163942a6ccd15 (diff) |
usb: gadget: error out if g_dnl registration fails
If g_dnl_register fails return an error rather then stubornly
continuing onwards.
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Diffstat (limited to 'cmd/usb_gadget_sdp.c')
-rw-r--r-- | cmd/usb_gadget_sdp.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cmd/usb_gadget_sdp.c b/cmd/usb_gadget_sdp.c index 808ed974fa..2ead06be9f 100644 --- a/cmd/usb_gadget_sdp.c +++ b/cmd/usb_gadget_sdp.c @@ -13,7 +13,7 @@ static int do_sdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - int ret = CMD_RET_FAILURE; + int ret; if (argc < 2) return CMD_RET_USAGE; @@ -23,7 +23,11 @@ static int do_sdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) usb_gadget_initialize(controller_index); g_dnl_clear_detach(); - g_dnl_register("usb_dnl_sdp"); + ret = g_dnl_register("usb_dnl_sdp"); + if (ret) { + pr_err("SDP dnl register failed: %d\n", ret); + goto exit_register; + } ret = sdp_init(controller_index); if (ret) { @@ -37,9 +41,10 @@ static int do_sdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) exit: g_dnl_unregister(); +exit_register: usb_gadget_release(controller_index); - return ret; + return CMD_RET_FAILURE; } U_BOOT_CMD(sdp, 2, 1, do_sdp, |