ASoC: cs35l45: Check spi_setup() return value
Subsystems (3)
PATCH 1/1 ASoC: cs35l45: Check spi_setup() return value
The SPI probe ignores errors from spi_setup() after updating the maximum bus frequency. If setup fails, initialization continues and accesses the device without ensuring that the SPI configuration succeeded.
Check the return value and abort probe on failure, propagating the original error.
Found by Linux Verification Center (linuxtesting.org) with SVACE static analysis tool.
Fixes 74b14e2850a3 ("ASoC: cs35l45: DSP Support")
Signed-off-by Alex Kazinsky <[email protected]>
--- sound/soc/codecs/cs35l45-spi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/codecs/cs35l45-spi.c +3 -1
@@ -24,7 +24,9 @@ static int cs35l45_spi_probe(struct spi_device *spi)return -ENOMEM ; spi->max_speed_hz =CS35L45_SPI_MAX_FREQ ; -spi_setup (spi); + ret =spi_setup (spi); +if (ret) +return ret;spi_set_drvdata (spi, cs35l45); cs35l45->regmap =devm_regmap_init_spi (spi, &cs35l45_spi_regmap);
Signature · 1 line
2.56.0