ASoC: codecs: rx-macro: fix accessing compander for aux
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tue, 22 Feb 2022 18:32:04 +0000 (18:32 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 23 Feb 2022 02:04:02 +0000 (02:04 +0000)
AUX interpolator does not have compander, so check before accessing
compander data for this.

Without this checkan array of out bounds access will be made in
comp_enabled[] array.

Fixes: 4f692926f562 ("ASoC: codecs: lpass-rx-macro: add dapm widgets and route")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220222183212.11580-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/lpass-rx-macro.c

index 6ffe88345de5ffdc6abb6fb030ee82267f82966a..1ac0bc1c86b36335fa1be8626657493babc0a080 100644 (file)
@@ -2039,6 +2039,10 @@ static int rx_macro_load_compander_coeff(struct snd_soc_component *component,
        int i;
        int hph_pwr_mode;
 
+       /* AUX does not have compander */
+       if (comp == INTERP_AUX)
+               return 0;
+
        if (!rx->comp_enabled[comp])
                return 0;