* [PATCH] ASoC: cs35l45: Check spi_setup() return value
@ 2026-11-13 11:09 Alex Kazinsky
0 siblings, 0 replies; only message in thread
From: Alex Kazinsky @ 2026-11-13 11:09 UTC (permalink / raw)
To: David Rhodes
Cc: Alex Kazinsky, Richard Fitzgerald, Liam Girdwood, Mark Brown,
Jaroslav Kysela, Takashi Iwai, Vlad . Karpovich, linux-sound,
patches, linux-kernel, lvc-project
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 <a.kazinsky@ideco.ru>
---
sound/soc/codecs/cs35l45-spi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/cs35l45-spi.c b/sound/soc/codecs/cs35l45-spi.c
index 76f46dc5ab2c..dcef36d31c45 100644
--- a/sound/soc/codecs/cs35l45-spi.c
+++ b/sound/soc/codecs/cs35l45-spi.c
@@ -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);
--
2.56.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-13 11:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-13 11:09 [PATCH] ASoC: cs35l45: Check spi_setup() return value Alex Kazinsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®