[PATCH] spi: npcm-fiu: Remove repeated test

Andrew Goodbody andrew.goodbody at linaro.org
Tue Aug 12 18:29:07 CEST 2025


In npcm_fiu_uma_operation to enter a code block nbytes must be non-zero.
So testing for nbytes inside the code block is redundant and can be
removed.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
 drivers/spi/npcm_fiu_spi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/spi/npcm_fiu_spi.c b/drivers/spi/npcm_fiu_spi.c
index 7b8271c8bbc..761ef8c058b 100644
--- a/drivers/spi/npcm_fiu_spi.c
+++ b/drivers/spi/npcm_fiu_spi.c
@@ -273,8 +273,7 @@ static int npcm_fiu_uma_operation(struct npcm_fiu_priv *priv, const struct spi_m
 	if (op->data.dir == SPI_MEM_DATA_OUT && nbytes) {
 		memcpy(data_reg, tx, nbytes);
 
-		if (nbytes)
-			writel(data_reg[0], &regs->uma_dw0);
+		writel(data_reg[0], &regs->uma_dw0);
 		if (nbytes > DW_SIZE)
 			writel(data_reg[1], &regs->uma_dw1);
 		if (nbytes > DW_SIZE * 2)

---
base-commit: 7807ed921314cd7af83fd88162d0b8c6fb20a9ca
change-id: 20250812-npcm_fiu_spi-36b1e7b13818

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



More information about the U-Boot mailing list