]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
spi: ich: Do not use uninitialised value
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Tue, 12 Aug 2025 13:31:16 +0000 (14:31 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 28 Oct 2025 16:33:00 +0000 (10:33 -0600)
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@linaro.org>
drivers/spi/ich.c

index 2264ca83d665d3acd8a75aaf75313461cf0adb4f..733ff8ac7773bf39efc816752169c7a5d10fc7e0 100644 (file)
@@ -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);