The division calculation should be implemented using signed integer format.
This patch changes mc->shift from an unsigned type to a signed integer during the calculation.
Fixes: 501efdcb3b3a ("ASoC: SDCA: Pull the Q7.8 volume helpers out of soc-ops")
Signed-off-by: Shuming Fan <shumingf@realtek.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20260327082331.2277498-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
reg_val = snd_soc_component_read(component, reg);
- val = (sign_extend32(reg_val, mc->sign_bit) / mc->shift) - mc->min;
+ val = (sign_extend32(reg_val, mc->sign_bit) / (int)mc->shift) - mc->min;
return val & GENMASK(mc->sign_bit, 0);
}