summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMarek Vasut <[email protected]>2023-09-01 11:49:57 +0200
committerMarek Vasut <[email protected]>2023-09-15 23:38:02 +0200
commit99924db71f61ffb155cd4d0ce640376019126de8 (patch)
treeeebb3bef55dcc4b0fb81fbf3508e1ddf0503d805 /common
parent2dfae17512ec8fec4a44dbc35fb444ab2ed3b156 (diff)
spl: sdp: Detach the controller on error
In case anything errors out during the SDP transfer, detach the controller instead of bailing out right away. This way, the controller can be reattached on next attempt. Reviewed-by: Mattijs Korpershoek <[email protected]> Signed-off-by: Marek Vasut <[email protected]>
Diffstat (limited to 'common')
-rw-r--r--common/spl/spl_sdp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c
index cc4fb4f7cca..aae886d2e57 100644
--- a/common/spl/spl_sdp.c
+++ b/common/spl/spl_sdp.c
@@ -25,13 +25,13 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image,
ret = g_dnl_register("usb_dnl_sdp");
if (ret) {
pr_err("SDP dnl register failed: %d\n", ret);
- return ret;
+ goto err_detach;
}
ret = sdp_init(controller_index);
if (ret) {
pr_err("SDP init failed: %d\n", ret);
- return -ENODEV;
+ goto err_unregister;
}
/*
@@ -42,6 +42,9 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image,
ret = spl_sdp_handle(controller_index, spl_image, bootdev);
debug("SDP ended\n");
+err_unregister:
+ g_dnl_unregister();
+err_detach:
usb_gadget_release(controller_index);
return ret;
}