spi: core: Initialize returned status in spi_setup

The previous commit that made bits-per-word validation conditional
results in leaving no unconditional affectation of the status variable.

Since the variable is returned at the end of the function, initialize
it to avoid returning an undefined value.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Fixes: b3fe2e5167 ("spi: core: Only check bits_per_word validity when explicitly provided")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220414084040.975520-1-paul.kocialkowski@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Paul Kocialkowski 2022-04-14 10:40:40 +02:00 committed by Mark Brown
parent e7cc4244bc
commit 73f93db5c4
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -3474,7 +3474,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