On sam., août 19, 2023 at 16:24, Marek Vasut <[email protected]> wrote: > 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. > > Signed-off-by: Marek Vasut <[email protected]> > --- > Cc: Angus Ainslie <[email protected]> > Cc: Dmitrii Merkurev <[email protected]> > Cc: Eddie Cai <[email protected]> > Cc: Kever Yang <[email protected]> > Cc: Lukasz Majewski <[email protected]> > Cc: Miquel Raynal <[email protected]> > Cc: Mattijs Korpershoek <[email protected]> > Cc: Nishanth Menon <[email protected]> > Cc: Patrice Chotard <[email protected]> > Cc: Patrick Delaunay <[email protected]> > Cc: Philipp Tomsich <[email protected]> > Cc: Simon Glass <[email protected]> > Cc: Stefan Roese <[email protected]> > Cc: [email protected] > ---
Reviewed-by: Mattijs Korpershoek <[email protected]> Nitpick/question below > common/spl/spl_sdp.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c > index cc4fb4f7cca..f6b99c1af5a 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_detach; Shouldn't we call g_dnl_unregister(); here since g_dnl_register() was sucessfully called before? This would match what's done in common/dfu.c > } > > /* > @@ -42,6 +42,7 @@ 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_detach: > usb_gadget_release(controller_index); > return ret; > } > -- > 2.40.1

