1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 14:28:07 +00:00

refactor(core/embed): remove unnecessary call to usb_stop

[no changelog]
This commit is contained in:
cepetr 2024-06-01 17:30:38 +02:00 committed by cepetr
parent d8d6410284
commit 089dc84f38
3 changed files with 0 additions and 14 deletions

View File

@ -165,7 +165,6 @@ static usb_result_t bootloader_usb_loop(const vendor_header *const vhdr,
if (INPUT_CANCEL == response) {
send_user_abort(USB_IFACE_NUM, "Wipe cancelled");
hal_delay(100);
usb_stop();
usb_deinit();
return RETURN_TO_MENU;
}
@ -174,13 +173,11 @@ static usb_result_t bootloader_usb_loop(const vendor_header *const vhdr,
if (r < 0) { // error
screen_wipe_fail();
hal_delay(100);
usb_stop();
usb_deinit();
return SHUTDOWN;
} else { // success
screen_wipe_success();
hal_delay(100);
usb_stop();
usb_deinit();
return SHUTDOWN;
}
@ -197,12 +194,10 @@ static usb_result_t bootloader_usb_loop(const vendor_header *const vhdr,
} else {
ui_screen_fail();
}
usb_stop();
usb_deinit();
return SHUTDOWN;
} else if (r == UPLOAD_ERR_USER_ABORT) {
hal_delay(100);
usb_stop();
usb_deinit();
return RETURN_TO_MENU;
} else if (r == 0) { // last chunk received
@ -214,7 +209,6 @@ static usb_result_t bootloader_usb_loop(const vendor_header *const vhdr,
hal_delay(1000);
ui_screen_done(1, secfalse);
hal_delay(1000);
usb_stop();
usb_deinit();
return CONTINUE_TO_FIRMWARE;
}
@ -228,14 +222,12 @@ static usb_result_t bootloader_usb_loop(const vendor_header *const vhdr,
if (INPUT_CANCEL == response) {
send_user_abort(USB_IFACE_NUM, "Bootloader unlock cancelled");
hal_delay(100);
usb_stop();
usb_deinit();
return RETURN_TO_MENU;
}
process_msg_UnlockBootloader(USB_IFACE_NUM, msg_size, buf);
screen_unlock_bootloader_success();
hal_delay(100);
usb_stop();
usb_deinit();
return SHUTDOWN;
break;

View File

@ -117,12 +117,10 @@ static secbool bootloader_usb_loop(const vendor_header *const vhdr,
r = process_msg_WipeDevice(USB_IFACE_NUM, msg_size, buf);
if (r < 0) { // error
ui_screen_fail();
usb_stop();
usb_deinit();
return secfalse; // shutdown
} else { // success
ui_screen_done(0, sectrue);
usb_stop();
usb_deinit();
return secfalse; // shutdown
}
@ -134,7 +132,6 @@ static secbool bootloader_usb_loop(const vendor_header *const vhdr,
r = process_msg_FirmwareUpload(USB_IFACE_NUM, msg_size, buf);
if (r < 0 && r != UPLOAD_ERR_USER_ABORT) { // error, but not user abort
ui_screen_fail();
usb_stop();
usb_deinit();
return secfalse; // shutdown
} else if (r == 0) { // last chunk received
@ -146,7 +143,6 @@ static secbool bootloader_usb_loop(const vendor_header *const vhdr,
hal_delay(1000);
ui_screen_done(1, secfalse);
hal_delay(1000);
usb_stop();
usb_deinit();
return sectrue; // jump to firmware
}

View File

@ -251,7 +251,6 @@ STATIC mp_obj_t mod_trezorio_USB_close(mp_obj_t self) {
if (o->state != USB_OPENED) {
mp_raise_msg(&mp_type_RuntimeError, "not initialized");
}
usb_stop();
usb_deinit();
mp_obj_list_set_len(MP_OBJ_FROM_PTR(&o->ifaces), 0);
mp_seq_clear(o->ifaces.items, 0, o->ifaces.alloc, sizeof(*o->ifaces.items));
@ -271,7 +270,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_trezorio_USB_close_obj,
STATIC mp_obj_t mod_trezorio_USB___del__(mp_obj_t self) {
mp_obj_USB_t *o = MP_OBJ_TO_PTR(self);
if (o->state != USB_CLOSED) {
usb_stop();
usb_deinit();
o->state = USB_CLOSED;
}