When CONFIG_DM_USB is not defined then usb_gadget_initialize is just a call
to board_usb_init. Calling board_usb_init twice causes the USB to fail so
make sure the second invocation is not compiled in when CONFIG_DM_USB is
not defined.

Signed-off-by: Angus Ainslie <an...@akkea.ca>
---
 common/spl/spl_sdp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c
index ae9c09883a..2a2bc8475d 100644
--- a/common/spl/spl_sdp.c
+++ b/common/spl/spl_sdp.c
@@ -17,7 +17,8 @@ static int spl_sdp_load_image(struct spl_image_info 
*spl_image,
        int ret;
        const int controller_index = CONFIG_SPL_SDP_USB_DEV;
 
-       usb_gadget_initialize(controller_index);
+       if (IS_ENABLED(CONFIG_DM_USB))
+               usb_gadget_initialize(controller_index);
 
        board_usb_init(0, USB_INIT_DEVICE);
 
-- 
2.25.1

Reply via email to