Skip to content

Commit 4084c8c

Browse files
chleroybroonie
authored andcommitted
spi: fsl-spi: No need to check transfer length versus word size
The verification is already do in the SPI core by function __spi_validate(), not it to check it again in fsl_spi_bufs(). Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Link: https://lore.kernel.org/r/9ace69a8085e22fafd9159e99edd7bbfae2f9940.1680371809.git.christophe.leroy@csgroup.eu Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 99aebb3 commit 4084c8c

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

drivers/spi/spi-fsl-spi.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -263,18 +263,10 @@ static int fsl_spi_bufs(struct spi_device *spi, struct spi_transfer *t,
263263
if (t->bits_per_word)
264264
bits_per_word = t->bits_per_word;
265265

266-
if (bits_per_word > 8) {
267-
/* invalid length? */
268-
if (len & 1)
269-
return -EINVAL;
266+
if (bits_per_word > 8)
270267
len /= 2;
271-
}
272-
if (bits_per_word > 16) {
273-
/* invalid length? */
274-
if (len & 1)
275-
return -EINVAL;
268+
if (bits_per_word > 16)
276269
len /= 2;
277-
}
278270

279271
mpc8xxx_spi->tx = t->tx_buf;
280272
mpc8xxx_spi->rx = t->rx_buf;

0 commit comments

Comments
 (0)