[PATCH] spi: ich: Do not use uninitialised value

Andrew Goodbody andrew.goodbody at linaro.org
Tue Aug 12 15:31:16 CEST 2025


In ich_spi_exec_op_swseq the variable with_address is only assigned a
value in the case of op->addr.nbytes being non-zero.
Initialise with_address to zero. so that it is always valid.

This issue was found by Smatch.

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

diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
index 2264ca83d66..733ff8ac777 100644
--- a/drivers/spi/ich.c
+++ b/drivers/spi/ich.c
@@ -256,7 +256,7 @@ static int ich_spi_exec_op_swseq(struct spi_slave *slave,
 	struct ich_spi_priv *ctlr = dev_get_priv(bus);
 	uint16_t control;
 	int16_t opcode_index;
-	int with_address;
+	int with_address = 0;
 	int status;
 	struct spi_trans *trans = &ctlr->trans;
 	bool lock = spi_lock_status(plat, ctlr->base);

---
base-commit: 7807ed921314cd7af83fd88162d0b8c6fb20a9ca
change-id: 20250812-spi_ich-30077b4c6826

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



More information about the U-Boot mailing list