Skip to content

Commit a522062

Browse files
c-maudererkartben
authored andcommitted
drivers: spi: mchp_mss: Handle NULL buffers better
At the moment, if you would pass a NULL buffer to the driver, the rx and tx counts of that buffer would not advance. This patch fixes that. Signed-off-by: Christian Mauderer <[email protected]>
1 parent b398769 commit a522062

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/spi/spi_mchp_mss.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,19 +205,19 @@ static inline void mss_spi_readwr_fifo(const struct device *dev)
205205
rx_raw = mss_spi_read(cfg, MSS_SPI_REG_RX_DATA);
206206
if (spi_context_rx_buf_on(ctx)) {
207207
UNALIGNED_PUT(rx_raw, (uint8_t *)ctx->rx_buf);
208-
spi_context_update_rx(ctx, 1, 1);
209208
}
209+
spi_context_update_rx(ctx, 1, 1);
210210
++transfer_idx;
211211
}
212212

213213
if (!(mss_spi_read(cfg, MSS_SPI_REG_STATUS) & MSS_SPI_STATUS_TXFIFO_FULL)) {
214214
if (spi_context_tx_buf_on(ctx)) {
215215
data8 = ctx->tx_buf[0];
216216
mss_spi_write(cfg, MSS_SPI_REG_TX_DATA, data8);
217-
spi_context_update_tx(ctx, 1, 1);
218217
} else {
219218
mss_spi_write(cfg, MSS_SPI_REG_TX_DATA, 0x0);
220219
}
220+
spi_context_update_tx(ctx, 1, 1);
221221
}
222222
}
223223
}

0 commit comments

Comments
 (0)