Skip to content

Commit a0ce874

Browse files
niranjanhytibroonie
authored andcommitted
ASoC: ops: improve snd_soc_get_volsw
* clamp the values if the register value read is out of range Signed-off-by: Niranjan H Y <niranjan.hy@ti.com> [This patch originally had two changes in it, I removed a second buggy one -- broonie] -- v5: - remove clamp parameter - move the boundary check after sign-bit extension Link: https://patch.msgid.link/20250912083624.804-1-niranjan.hy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 5998f0d commit a0ce874

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

sound/soc/soc-ops.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ static int soc_mixer_reg_to_ctl(struct soc_mixer_control *mc, unsigned int reg_v
118118
if (mc->sign_bit)
119119
val = sign_extend32(val, mc->sign_bit);
120120

121+
val = clamp(val, mc->min, mc->max);
121122
val -= mc->min;
122123

123124
if (mc->invert)

0 commit comments

Comments
 (0)