mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-17 10:24:49 +00:00
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>
This commit is contained in:
parent
634931fea5
commit
25ee924649
2 changed files with 13 additions and 4 deletions
|
@ -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,
|
||||
|
|
|
@ -17,7 +17,11 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image,
|
|||
const int controller_index = 0;
|
||||
|
||||
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);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = sdp_init(controller_index);
|
||||
if (ret) {
|
||||
|
|
Loading…
Add table
Reference in a new issue