summaryrefslogtreecommitdiff
path: root/libhw_cr/rp2040_hwspi.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-05-12 14:26:21 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-05-12 14:26:21 -0600
commit811d9700e1414dae3357361b3ca565f673f63b08 (patch)
treece628075a2ae59d5362d2662465c918f57e81607 /libhw_cr/rp2040_hwspi.c
parentcd5e55ebb7d5a51c0a8bd62137ab75a0f6ff1356 (diff)
parentb4a081932338f65aa87aeba5008463feb0a78519 (diff)
Merge branch 'lukeshu/misc'
Diffstat (limited to 'libhw_cr/rp2040_hwspi.c')
-rw-r--r--libhw_cr/rp2040_hwspi.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libhw_cr/rp2040_hwspi.c b/libhw_cr/rp2040_hwspi.c
index c0b4fa4..3bf3f84 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:
*
@@ -230,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. */