]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ASoC: cs48l32: Fix a signedness bug in cs48l32_hw_params()
authorHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Tue, 3 Jun 2025 21:48:13 +0000 (14:48 -0700)
committerMark Brown <broonie@kernel.org>
Sun, 8 Jun 2025 22:29:04 +0000 (23:29 +0100)
commit22188b9df60dde48eaba276da22062aaf8e12dfe
tree0b5400cf5309cfc1868bc18719f19faa686f3a8e
parent19272b37aa4f83ca52bdf9c16d5d81bdd1354494
ASoC: cs48l32: Fix a signedness bug in cs48l32_hw_params()

There is a type promotion that can happen when freq(u32) variable is
comapared with sclk_target(integer), when sclk_target is a negative
value it promotes to a large postive integer which might not be a
problem in this particular case as the condition evaluates to false
when that happens, but bail out early when sclk_target has negative
error codes.

cs48l32_sclk_rates[i].freq >= sclk_target

Fix this by adding a negative error check when
snd_soc_tdm_params_to_bclk() fails

Fixes: e2bcbf99d045 ("ASoC: cs48l32: Add driver for Cirrus Logic CS48L32 audio DSP")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Link: https://patch.msgid.link/20250603214813.197346-1-harshit.m.mogalapalli@oracle.com
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/cs48l32.c