From 4c06f269c5b87be733112d98ac55d2d416ba59ab Mon Sep 17 00:00:00 2001 From: Michael Field Date: Thu, 29 Oct 2026 16:54:31 -0700 Subject: [PATCH] [transports] Fix ioctl pointer argument in spi_nor_busy_wait Pass `&xfer` rather than `xfer` by value to `ioctl(fd, SPI_IOC_MESSAGE(1), ...)` when polling the SPI NOR status register WIP bit. --- transports/libhoth_spi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/transports/libhoth_spi.c b/transports/libhoth_spi.c index 18762bc..ac3c535 100644 --- a/transports/libhoth_spi.c +++ b/transports/libhoth_spi.c @@ -94,13 +94,15 @@ static libhoth_status spi_nor_busy_wait(const int fd, uint32_t timeout_us, return LIBHOTH_ERR_FAIL; } while (true) { - struct spi_ioc_transfer xfer = {0}; + struct spi_ioc_transfer xfer[1] = {0}; tx_buf[0] = SPI_NOR_OPCODE_READ_STATUS; - xfer.tx_buf = (uint64_t)tx_buf; - xfer.rx_buf = (uint64_t)rx_buf; - xfer.len = sizeof(rx_buf); - xfer.tx_nbits = SPI_NBITS_SINGLE; - xfer.rx_nbits = SPI_NBITS_SINGLE; + xfer[0] = (struct spi_ioc_transfer){ + .tx_buf = (unsigned long)tx_buf, + .rx_buf = (unsigned long)rx_buf, + .len = sizeof(rx_buf), + .tx_nbits = SPI_NBITS_SINGLE, + .rx_nbits = SPI_NBITS_SINGLE, + }; const int status = ioctl(fd, SPI_IOC_MESSAGE(1), xfer); if (status < 0) { return LIBHOTH_ERR_FAIL;