Skip to content

Commit ad5a097

Browse files
Vitaliy Shevtsovbroonie
authored andcommitted
ASoC: cs35l41: check the return value from spi_setup()
Currently the return value from spi_setup() is not checked for a failure. It is unlikely it will ever fail in this particular case but it is still better to add this check for the sake of completeness and correctness. This is cheap since it is performed once when the device is being probed. Handle spi_setup() return value. Found by Linux Verification Center (linuxtesting.org) with Svace. Fixes: 872fc0b ("ASoC: cs35l41: Set the max SPI speed for the whole device") Signed-off-by: Vitaliy Shevtsov <v.shevtsov@mt-integration.ru> Link: https://patch.msgid.link/20250304115643.2748-1-v.shevtsov@mt-integration.ru Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 8a7e7a0 commit ad5a097

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

sound/soc/codecs/cs35l41-spi.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@ static int cs35l41_spi_probe(struct spi_device *spi)
3232
const struct regmap_config *regmap_config = &cs35l41_regmap_spi;
3333
struct cs35l41_hw_cfg *hw_cfg = dev_get_platdata(&spi->dev);
3434
struct cs35l41_private *cs35l41;
35+
int ret;
3536

3637
cs35l41 = devm_kzalloc(&spi->dev, sizeof(struct cs35l41_private), GFP_KERNEL);
3738
if (!cs35l41)
3839
return -ENOMEM;
3940

4041
spi->max_speed_hz = CS35L41_SPI_MAX_FREQ;
41-
spi_setup(spi);
42+
ret = spi_setup(spi);
43+
if (ret < 0)
44+
return ret;
4245

4346
spi_set_drvdata(spi, cs35l41);
4447
cs35l41->regmap = devm_regmap_init_spi(spi, regmap_config);

0 commit comments

Comments
 (0)