1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/cc2420: don't append to FIFO if iol->iol_len == 0

This prevents SPI transfers with len == 0, which triggers
an assert failure.
This commit is contained in:
kYc0o 2019-04-02 16:00:03 +02:00
parent 299a1903e6
commit c6b424f4ff

View File

@ -131,9 +131,11 @@ size_t cc2420_tx_prepare(cc2420_t *dev, const iolist_t *iolist)
cc2420_strobe(dev, CC2420_STROBE_FLUSHTX);
/* push packet length to TX FIFO */
cc2420_fifo_write(dev, (uint8_t *)&pkt_len, 1);
/* push packet to TX FIFO */
/* push packet to TX FIFO, only if iol->iol_len > 0 */
for (const iolist_t *iol = iolist; iol; iol = iol->iol_next) {
cc2420_fifo_write(dev, iol->iol_base, iol->iol_len);
if (iol->iol_len > 0) {
cc2420_fifo_write(dev, iol->iol_base, iol->iol_len);
}
}
DEBUG("cc2420: tx_prep: loaded %i byte into the TX FIFO\n", (int)pkt_len);