Skip to content

Commit

Permalink
spi: fsl-spi: No need to check transfer length versus word size
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christophe Leroy authored and Mark Brown committed Apr 5, 2023
1 parent 99aebb3 commit 4084c8c
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions drivers/spi/spi-fsl-spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,18 +263,10 @@ static int fsl_spi_bufs(struct spi_device *spi, struct spi_transfer *t,
if (t->bits_per_word)
bits_per_word = t->bits_per_word;

if (bits_per_word > 8) {
/* invalid length? */
if (len & 1)
return -EINVAL;
if (bits_per_word > 8)
len /= 2;
}
if (bits_per_word > 16) {
/* invalid length? */
if (len & 1)
return -EINVAL;
if (bits_per_word > 16)
len /= 2;
}

mpc8xxx_spi->tx = t->tx_buf;
mpc8xxx_spi->rx = t->rx_buf;
Expand Down

0 comments on commit 4084c8c

Please sign in to comment.