]> git.hungrycats.org Git - linux/commit
ASoC: cs35l56: Fix possible uninitialized value in cs35l56_spi_system_reset()
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Thu, 11 Jun 2026 13:22:21 +0000 (14:22 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 11 Jun 2026 14:07:00 +0000 (15:07 +0100)
commit007699d278a655871b07d45a1268761260d03124
tree8a9f182adc2e804494635e5c200452c957f46096
parent79bec463819428912e1cfcb534e4379093b422ce
ASoC: cs35l56: Fix possible uninitialized value in cs35l56_spi_system_reset()

In cs35l56_spi_system_reset() initialize val to zero before using it in
the read_poll_timeout(). This prevents testing an uninitialized value if
the regmap_read_bypassed() returns an error.

Read errors are intentionally ignored during this loop because the
device is resetting (though SPI can't really detect that so shouldn't
fail because of that, it's safer to ignore errors and keep polling).
Because of this, val must be initialized to something in case the first
read fails. The polling loop is looking for a non-zero value, so
initializing val to 0 will ensure that the loop continues until a valid
state is read from the device or it times out.

Fixes: 769c1b79295c ("ASoC: cs35l56: Prevent races when soft-resetting using SPI control")
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20260611132221.1100497-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/cs35l56-shared.c