]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
spi: stm32: clean up buffer length assignment
authorDario Binacchi <dario.binacchi@amarulasolutions.com>
Wed, 25 Feb 2026 16:16:56 +0000 (17:16 +0100)
committerPatrice Chotard <patrice.chotard@foss.st.com>
Thu, 30 Apr 2026 06:01:11 +0000 (08:01 +0200)
Remove redundant divisions by using the already available xferlen
variable for setting the rx/tx buffer lengths.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
drivers/spi/stm32_spi.c

index a1f31cf653c7358811705be1a4985d7f1b2fadc5..adba97915cd3f9c0d847b6fa4d1b42cabe06b937 100644 (file)
@@ -404,8 +404,8 @@ static int stm32_spi_xfer(struct udevice *slave, unsigned int bitlen,
 
        priv->tx_buf = dout;
        priv->rx_buf = din;
-       priv->tx_len = priv->tx_buf ? bitlen / 8 : 0;
-       priv->rx_len = priv->rx_buf ? bitlen / 8 : 0;
+       priv->tx_len = priv->tx_buf ? xferlen : 0;
+       priv->rx_len = priv->rx_buf ? xferlen : 0;
 
        mode = SPI_FULL_DUPLEX;
        if (!priv->tx_buf)