On Wed, Dec 17, 2025 at 02:06:23PM +0200, Peter Ujfalusi wrote:
sound/soc/soc-ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c index ce86978c158d..6a18c56a9746 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -148,7 +148,7 @@ static int soc_mixer_reg_to_ctl(struct soc_mixer_control *mc, unsigned int reg_v if (mc->sign_bit) val = sign_extend32(val, mc->sign_bit);
- val = clamp(val, mc->min, mc->max);
- val = clamp(val, mc->min, mc->min + max);
This won't work, for an SX control it is perfectly valid for the value read from the register to be smaller than the minimum value specified in the control.
The minimum value gives the register value that equates to the smallest possible control value. From there the values increase but the register field can overflow and end up lower than the min. I often think of it in terms of a 2's compliement number with an implicit sign bit.
Thanks, Charles