Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: b3fe2e516741 ("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>

authored by

Paul Kocialkowski and committed by
Mark Brown
73f93db5 e7cc4244

+1 -1
+1 -1
drivers/spi/spi.c
··· 3474 3474 int spi_setup(struct spi_device *spi) 3475 3475 { 3476 3476 unsigned bad_bits, ugly_bits; 3477 - int status; 3477 + int status = 0; 3478 3478 3479 3479 /* 3480 3480 * Check mode to prevent that any two of DUAL, QUAD and NO_MOSI/MISO