From db9a58f48c6eae16fbfcd89d59b09e123dbed54f Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Tue, 15 Apr 2025 15:58:31 -0600 Subject: libmisc: Add alloc.h to help detect wrong alloc sizes Lo and behold, there was a mistake in chan.c. --- libhw_cr/rp2040_hwspi.c | 6 +++--- 1 file changed, 3 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 d181650..29a7bac 100644 --- a/libhw_cr/rp2040_hwspi.c +++ b/libhw_cr/rp2040_hwspi.c @@ -4,7 +4,6 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -#include #include /* for PRIu{n} */ #include /* for clock_get_hz() and clk_peri */ @@ -12,6 +11,7 @@ #include #include +#include #include #define LOG_NAME RP2040_SPI @@ -198,8 +198,8 @@ static void rp2040_hwspi_readwritev(struct rp2040_hwspi *self, const struct dupl * happens, so the IRQ machinery doesn't need to be engaged * at all. */ - struct dma_alias1 *tx_data_blocks = alloca(sizeof(struct dma_alias1)*(pruned_iovcnt+1)); - struct dma_alias0 *rx_data_blocks = alloca(sizeof(struct dma_alias0)*(pruned_iovcnt+1)); + struct dma_alias1 *tx_data_blocks = stack_alloc(pruned_iovcnt+1, struct dma_alias1); + struct dma_alias0 *rx_data_blocks = stack_alloc(pruned_iovcnt+1, struct dma_alias0); static_assert(!DMA_IS_TRIGGER(typeof(tx_data_blocks[0]), ctrl)); static_assert(DMA_IS_TRIGGER(typeof(rx_data_blocks[0]), ctrl)); -- cgit v1.2.3-2-g168b