[PATCH v2] spi: exynos: Remove extra term from test

Andrew Goodbody andrew.goodbody at linaro.org
Mon Sep 1 17:13:14 CEST 2025


In spi_rx_tx there comes a test for execution of a code block that
allows execution if rxp is not NULL or stopping is true. However all the
code in this block relies on rxp being valid so allowing entry just if
stopping is true does not make sense. So remove this from the test
expression leaving just a NULL check for rxp.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
Changes in v2:
- Remove the stopping variable which is now not useful
- Link to v1: https://lore.kernel.org/r/20250812-exynos_spi-v1-1-bd0813ff6593@linaro.org
---
 drivers/spi/exynos_spi.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/exynos_spi.c b/drivers/spi/exynos_spi.c
index 1b9bf004b7c..7f2965f8321 100644
--- a/drivers/spi/exynos_spi.c
+++ b/drivers/spi/exynos_spi.c
@@ -105,14 +105,10 @@ static int spi_rx_tx(struct exynos_spi_priv *priv, int todo,
 	uint out_bytes, in_bytes;
 	int toread;
 	unsigned start = get_timer(0);
-	int stopping;
 	int step;
 
 	out_bytes = in_bytes = todo;
 
-	stopping = priv->skip_preamble && (flags & SPI_XFER_END) &&
-					!(priv->mode & SPI_SLAVE);
-
 	/*
 	 * Try to transfer words if we can. This helps read performance at
 	 * SPI clock speeds above about 20MHz.
@@ -161,12 +157,10 @@ static int spi_rx_tx(struct exynos_spi_priv *priv, int todo,
 			while (rx_lvl >= step) {
 				temp = readl(&regs->rx_data);
 				if (priv->skip_preamble) {
-					if (temp == SPI_PREAMBLE_END_BYTE) {
+					if (temp == SPI_PREAMBLE_END_BYTE)
 						priv->skip_preamble = 0;
-						stopping = 0;
-					}
 				} else {
-					if (rxp || stopping) {
+					if (rxp) {
 						if (step == 4)
 							*(uint32_t *)rxp = temp;
 						else

---
base-commit: 7807ed921314cd7af83fd88162d0b8c6fb20a9ca
change-id: 20250812-exynos_spi-8172ecb31a83

Best regards,
-- 
Andrew Goodbody <andrew.goodbody at linaro.org>



More information about the U-Boot mailing list