In case anything errors out during the DFU registration, detach
the controller instead of bailing out right away. This way, the
controller can be reattached on next attempt.
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Marek Vasut <marex@denx.de>
ret = g_dnl_register(usb_dnl_gadget);
if (ret) {
pr_err("g_dnl_register failed");
- return CMD_RET_FAILURE;
+ ret = CMD_RET_FAILURE;
+ goto err_detach;
}
#ifdef CONFIG_DFU_TIMEOUT
}
exit:
g_dnl_unregister();
+err_detach:
usb_gadget_release(usbctrl_index);
if (dfu_reset)