From 42729f477684b12735b572a4975d32fb1002a530 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 26 Apr 2025 23:30:31 -0600 Subject: libhw_generic: io.h: Clarify that sum lenghts of iovecs must not be 0 --- libhw_cr/rp2040_hwspi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'libhw_cr/rp2040_hwspi.c') 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: * -- cgit v1.2.3-2-g168b From b4a081932338f65aa87aeba5008463feb0a78519 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Mon, 12 May 2025 14:17:05 -0600 Subject: More GCC 15 fixes --- libhw_cr/rp2040_hwspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libhw_cr/rp2040_hwspi.c') diff --git a/libhw_cr/rp2040_hwspi.c b/libhw_cr/rp2040_hwspi.c index ee03b03..3bf3f84 100644 --- a/libhw_cr/rp2040_hwspi.c +++ b/libhw_cr/rp2040_hwspi.c @@ -232,8 +232,8 @@ static void rp2040_hwspi_readwritev(struct rp2040_hwspi *self, const struct dupl }; j++; } - tx_data_blocks[pruned_iovcnt] = (typeof(tx_data_blocks[0])){0}; - rx_data_blocks[pruned_iovcnt] = (typeof(rx_data_blocks[0])){0}; + tx_data_blocks[pruned_iovcnt] = (typeof(tx_data_blocks[0])){}; + rx_data_blocks[pruned_iovcnt] = (typeof(rx_data_blocks[0])){}; /* If ctrl isn't the trigger then we need to make sure that * DMA_CTRL_IRQ_QUIET isn't cleared before the trigger * happens. */ -- cgit v1.2.3-2-g168b