fix cid 395629 - simpler logic

This commit is contained in:
iceman1001 2022-07-06 12:21:14 +02:00
parent 1d66525b8e
commit 742194896d

View file

@ -699,34 +699,18 @@ finish2:
} }
static int reboot_bootloader_pm3(char *serial_port_name) { static int reboot_bootloader_pm3(char *serial_port_name) {
int ret = PM3_EUNDEF;
if (serial_port_name == NULL) { if (serial_port_name == NULL) {
PrintAndLogEx(ERR, "You must specify a port.\n"); PrintAndLogEx(ERR, "You must specify a port.\n");
return PM3_EINVARG; return PM3_EINVARG;
} }
if (OpenProxmark(&g_session.current_device, serial_port_name, true, 60, true, FLASHMODE_SPEED)) { if (OpenProxmark(&g_session.current_device, serial_port_name, true, 60, true, FLASHMODE_SPEED) == false) {
PrintAndLogEx(NORMAL, _GREEN_(" found"));
} else {
PrintAndLogEx(ERR, "Could not find Proxmark3 on " _RED_("%s") ".\n", serial_port_name); PrintAndLogEx(ERR, "Could not find Proxmark3 on " _RED_("%s") ".\n", serial_port_name);
ret = PM3_ETIMEOUT; return PM3_ETIMEOUT;
goto finish2;
} }
ret = flash_reboot_bootloader(serial_port_name); PrintAndLogEx(NORMAL, _GREEN_(" found"));
return ret; return flash_reboot_bootloader(serial_port_name);
finish2:
if (ret == PM3_SUCCESS)
PrintAndLogEx(SUCCESS, _CYAN_("All done"));
else if (ret == PM3_EOPABORTED)
PrintAndLogEx(FAILED, "Aborted by user");
else
PrintAndLogEx(ERR, "Aborted on error");
PrintAndLogEx(INFO, "\nHave a nice day!");
return ret;
} }
#endif //LIBPM3 #endif //LIBPM3