@@ -160,6 +160,7 @@ static size_t _xfer(tuh_xfer_t *xfer, mp_int_t timeout) {
160160 xfer -> complete_cb = _transfer_done_cb ;
161161 if (!tuh_edpt_xfer (xfer )) {
162162 mp_raise_usb_core_USBError (NULL );
163+ return 0 ;
163164 }
164165 uint32_t start_time = supervisor_ticks_ms32 ();
165166 while ((timeout == 0 || supervisor_ticks_ms32 () - start_time < (uint32_t )timeout ) &&
@@ -206,6 +207,7 @@ static bool _open_endpoint(usb_core_device_obj_t *self, mp_int_t endpoint) {
206207
207208 if (self -> configuration_descriptor == NULL ) {
208209 mp_raise_usb_core_USBError (MP_ERROR_TEXT ("No configuration set" ));
210+ return false;
209211 }
210212
211213 tusb_desc_configuration_t * desc_cfg = (tusb_desc_configuration_t * )self -> configuration_descriptor ;
@@ -240,6 +242,7 @@ static bool _open_endpoint(usb_core_device_obj_t *self, mp_int_t endpoint) {
240242mp_int_t common_hal_usb_core_device_write (usb_core_device_obj_t * self , mp_int_t endpoint , const uint8_t * buffer , mp_int_t len , mp_int_t timeout ) {
241243 if (!_open_endpoint (self , endpoint )) {
242244 mp_raise_usb_core_USBError (NULL );
245+ return 0 ;
243246 }
244247 tuh_xfer_t xfer ;
245248 xfer .daddr = self -> device_number ;
@@ -252,6 +255,7 @@ mp_int_t common_hal_usb_core_device_write(usb_core_device_obj_t *self, mp_int_t
252255mp_int_t common_hal_usb_core_device_read (usb_core_device_obj_t * self , mp_int_t endpoint , uint8_t * buffer , mp_int_t len , mp_int_t timeout ) {
253256 if (!_open_endpoint (self , endpoint )) {
254257 mp_raise_usb_core_USBError (NULL );
258+ return 0 ;
255259 }
256260 tuh_xfer_t xfer ;
257261 xfer .daddr = self -> device_number ;
@@ -286,6 +290,7 @@ mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self,
286290
287291 if (!tuh_control_xfer (& xfer )) {
288292 mp_raise_usb_core_USBError (NULL );
293+ return 0 ;
289294 }
290295 uint32_t start_time = supervisor_ticks_ms32 ();
291296 while ((timeout == 0 || supervisor_ticks_ms32 () - start_time < (uint32_t )timeout ) &&
0 commit comments