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

Merge pull request #11331 from kYc0o/pr/cc2420/fix_0_len_pkt

drivers/cc2420: don't append to FIFO if iol->iol_len == 0
This commit is contained in:
Martine Lenders 2019-04-02 16:29:24 +02:00 committed by GitHub
commit 4e464bdbc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);