[PATCH 2/5] spi: Limit spi_set_wordlen to SPI_DEFAULT_WORDLEN

John Watts contact at jookia.org
Fri Jun 14 14:18:42 CEST 2024


We have no way to tell if we can actually set the wordlen in non-DM
code, so limit it to the default wordlen already in use.

Signed-off-by: John Watts <contact at jookia.org>
---
 drivers/spi/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 3649c9c25b..7be9bf9b17 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -12,7 +12,7 @@ int spi_set_wordlen(struct spi_slave *slave, unsigned int wordlen)
 {
 	int oldwordlen = slave->wordlen;
 
-	if (wordlen == 0 || wordlen > 32) {
+	if (wordlen != SPI_DEFAULT_WORDLEN) {
 		printf("spi: invalid wordlen %u\n", wordlen);
 		return -1;
 	}

-- 
2.45.2



More information about the U-Boot mailing list