mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-21 00:26:22 +03:00
Reorder sanity checks in jtag3_paged_load() and jtag3_paged_load_tpi()
This commit is contained in:
20
src/jtag3.c
20
src/jtag3.c
@@ -2096,15 +2096,15 @@ static int jtag3_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRME
|
||||
if((status = jtag3_command(pgm, cmd, 12, &resp, "read memory")) < 0)
|
||||
return -1;
|
||||
|
||||
if((resp && resp[1] != RSP3_DATA) || status < (int) block_size + 4) {
|
||||
pmsg_error("wrong/short reply to read memory command\n");
|
||||
serial_recv_timeout = otimeout;
|
||||
if(status < 4) {
|
||||
pmsg_error("unexpected response from read memory jtag3_command()\n");
|
||||
mmt_free(resp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(status < 4) {
|
||||
pmsg_error("unexpected response from read memory jtag3_command()\n");
|
||||
if((resp && resp[1] != RSP3_DATA) || status < (int) block_size + 4) {
|
||||
pmsg_error("wrong/short reply to read memory command\n");
|
||||
serial_recv_timeout = otimeout;
|
||||
mmt_free(resp);
|
||||
return -1;
|
||||
}
|
||||
@@ -3166,15 +3166,15 @@ static int jtag3_paged_load_tpi(const PROGRAMMER *pgm, const AVRPART *p,
|
||||
if((status = jtag3_command_tpi(pgm, cmd, 8, &resp, "Read Memory")) < 0)
|
||||
return -1;
|
||||
|
||||
if((resp && resp[1] != XPRG_ERR_OK) || status < (int) block_size + 2) {
|
||||
pmsg_error("wrong/short reply to read memory command\n");
|
||||
serial_recv_timeout = otimeout;
|
||||
if(status < 2) {
|
||||
pmsg_error("unexpected return value %d from jtag3_paged_load_tpi()\n", status);
|
||||
mmt_free(resp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(status < 2) {
|
||||
pmsg_error("unexpected return value %d from jtag3_paged_load_tpi()\n", status);
|
||||
if((resp && resp[1] != XPRG_ERR_OK) || status < (int) block_size + 2) {
|
||||
pmsg_error("wrong/short reply to read memory command\n");
|
||||
serial_recv_timeout = otimeout;
|
||||
mmt_free(resp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user