ASoC: ops: add correct range check for limiting volume
[platform/kernel/linux-starfive.git] / sound / soc / soc-ops.c
index 55b009d..2d25748 100644 (file)
@@ -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;
                }