diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-26 23:30:31 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-05-12 13:02:05 -0600 |
commit | 42729f477684b12735b572a4975d32fb1002a530 (patch) | |
tree | 8edcd3eede207af6d9ae2557f8fcb05290659597 /libhw_cr/rp2040_hwspi.c | |
parent | 5255dbd5196f0125b51d969c46e46ac5765db7ed (diff) |
libhw_generic: io.h: Clarify that sum lenghts of iovecs must not be 0
Diffstat (limited to 'libhw_cr/rp2040_hwspi.c')
-rw-r--r-- | libhw_cr/rp2040_hwspi.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libhw_cr/rp2040_hwspi.c b/libhw_cr/rp2040_hwspi.c index c0b4fa4..ee03b03 100644 --- a/libhw_cr/rp2040_hwspi.c +++ b/libhw_cr/rp2040_hwspi.c @@ -158,12 +158,14 @@ static void rp2040_hwspi_readwritev(struct rp2040_hwspi *self, const struct dupl uint8_t bogus_rx_dst; + size_t count = 0; int pruned_iovcnt = 0; - for (int i = 0; i < iovcnt; i++) + for (int i = 0; i < iovcnt; i++) { + count += iov[i].iov_len; if (iov[i].iov_len) pruned_iovcnt++; - if (!pruned_iovcnt) - return; + } + assert(count); /* It doesn't *really* matter which aliases we choose: * |