[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220416205132.295779-1-trix@redhat.com>
Date: Sat, 16 Apr 2022 16:51:32 -0400
From: Tom Rix <trix@...hat.com>
To: broonie@...nel.org, nathan@...nel.org, ndesaulniers@...gle.com,
paul.kocialkowski@...tlin.com
Cc: linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, Tom Rix <trix@...hat.com>
Subject: [PATCH] spi: initialize status to success
Clang static analysis reports this issue
spi.c:3583:2: warning: 2nd function call argument
is an uninitialized value
trace_spi_setup(spi, status);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is possible that status is never set because
its function level setting was removed by the
commit listed in the Fixes: tag.
Assume that setting 8 bits-per-word is ok and
initialize the status to 0.
Fixes: b3fe2e516741 ("spi: core: Only check bits_per_word validity when explicitly provided")
Signed-off-by: Tom Rix <trix@...hat.com>
---
drivers/spi/spi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 563a56ce34a0..890ff46c784a 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -3475,7 +3475,7 @@ static int __spi_validate_bits_per_word(struct spi_controller *ctlr,
int spi_setup(struct spi_device *spi)
{
unsigned bad_bits, ugly_bits;
- int status;
+ int status = 0;
/*
* Check mode to prevent that any two of DUAL, QUAD and NO_MOSI/MISO
--
2.27.0
Powered by blists - more mailing lists