hosted/ftdi: Fix bad length calculation in MPSSE case of swdptap_seq_in()

This commit is contained in:
Uwe Bonnes 2022-01-23 16:55:38 +01:00 committed by Rachel Mant
parent 266fe17461
commit 6a9b2b8224
1 changed files with 4 additions and 1 deletions

View File

@ -305,7 +305,10 @@ static uint32_t swdptap_seq_in(int ticks)
if (do_mpsse) {
uint8_t DO[4];
libftdi_jtagtap_tdi_tdo_seq(DO, 0, NULL, ticks);
for (int i = 0; i < (ticks >> 3) + (ticks & 7)? 1: 0; i++) {
int bytes = ticks >> 3;
if (ticks & 7)
bytes++;
for (int i = 0; i < bytes; i++) {
result |= DO[i] << (8 * i);
}
} else {