From db58dc5438ec674cad438a606edc155d06914adc Mon Sep 17 00:00:00 2001 From: Dhruva Gole Date: Wed, 1 Mar 2023 13:13:46 +0530 Subject: [PATCH] spi: spi-mem: perform odd len check only while writing data in spi_mem_dtr_supports_op we have a check for allowing only even number of bytes to be r/w. Odd bytes writing can be a concern while writing data to a flash for example because 8 DTR mode doesn't support it. However, reading ODD Bytes even though may not be physically possible we can still allow for it because it will not have serious implications on any critical registers being overwritten since they are just reads. Cc: Vaishnav Achath Cc: Pratyush Yadav Cc: Vignesh Raghavendra Tested-by: Nikhil M Jain Signed-off-by: Dhruva Gole Reviewed-by: Jagan Teki --- drivers/spi/spi-mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c index 57a36f31a5..b7eca58359 100644 --- a/drivers/spi/spi-mem.c +++ b/drivers/spi/spi-mem.c @@ -185,7 +185,7 @@ bool spi_mem_dtr_supports_op(struct spi_slave *slave, * Transactions of odd length do not make sense for 8D-8D-8D mode * because a byte is transferred in just half a cycle. */ - if (op->data.dir != SPI_MEM_NO_DATA && + if (op->data.dir != SPI_MEM_NO_DATA && op->data.dir != SPI_MEM_DATA_IN && op->data.buswidth == 8 && op->data.nbytes % 2) return false; -- 2.39.5