[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231211135147.380223-29-sashal@kernel.org>
Date: Mon, 11 Dec 2023 08:50:30 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Johan Hovold <johan+linaro@...nel.org>,
Mark Brown <broonie@...nel.org>,
Sasha Levin <sashal@...nel.org>, lgirdwood@...il.com,
perex@...ex.cz, tiwai@...e.com, linux-sound@...r.kernel.org
Subject: [PATCH AUTOSEL 6.6 29/47] ASoC: ops: add correct range check for limiting volume
From: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
[ Upstream commit fb9ad24485087e0f00d84bee7a5914640b2b9024 ]
Volume can have ranges that start with negative values, ex: -84dB to
+40dB. Apply correct range check in snd_soc_limit_volume before setting
the platform_max. Without this patch, for example setting a 0dB limit on
a volume range of -84dB to +40dB would fail.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Tested-by: Johan Hovold <johan+linaro@...nel.org>
Reviewed-by: Johan Hovold <johan+linaro@...nel.org>
Link: https://lore.kernel.org/r/20231204124736.132185-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@...nel.org>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
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 55b009d3c6815..2d25748ca7066 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -661,7 +661,7 @@ int snd_soc_limit_volume(struct snd_soc_card *card,
kctl = snd_soc_card_get_kcontrol(card, name);
if (kctl) {
struct soc_mixer_control *mc = (struct soc_mixer_control *)kctl->private_value;
- if (max <= mc->max) {
+ if (max <= mc->max - mc->min) {
mc->platform_max = max;
ret = 0;
}
--
2.42.0
Powered by blists - more mailing lists