mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-23 17:46:33 +03:00
Return -1 in stk500v2_open() or stk600v2_open() if drain() or getsync() fails
This commit is contained in:
@@ -2124,14 +2124,9 @@ static int stk500v2_open(PROGRAMMER *pgm, const char *port) {
|
||||
if (serdev && serdev->usbsn)
|
||||
pgm->usbsn = serdev->usbsn;
|
||||
|
||||
/*
|
||||
* drain any extraneous input
|
||||
*/
|
||||
stk500v2_drain(pgm, 0);
|
||||
|
||||
stk500v2_getsync(pgm);
|
||||
|
||||
stk500v2_drain(pgm, 0);
|
||||
// Drain any extraneous input, synchronise and drain again
|
||||
if(stk500v2_drain(pgm, 0) < 0 || stk500v2_getsync(pgm) < 0 || stk500v2_drain(pgm, 0) < 0)
|
||||
return -1;
|
||||
|
||||
if (pgm->bitclock != 0.0) {
|
||||
if (pgm->set_sck_period(pgm, pgm->bitclock) != 0)
|
||||
@@ -2181,14 +2176,9 @@ static int stk600_open(PROGRAMMER *pgm, const char *port) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* drain any extraneous input
|
||||
*/
|
||||
stk500v2_drain(pgm, 0);
|
||||
|
||||
stk500v2_getsync(pgm);
|
||||
|
||||
stk500v2_drain(pgm, 0);
|
||||
// Drain any extraneous input, synchronise and drain again
|
||||
if(stk500v2_drain(pgm, 0) < 0 || stk500v2_getsync(pgm) < 0 || stk500v2_drain(pgm, 0) < 0)
|
||||
return -1;
|
||||
|
||||
if (pgm->bitclock != 0.0) {
|
||||
if (pgm->set_sck_period(pgm, pgm->bitclock) != 0)
|
||||
|
||||
Reference in New Issue
Block a user