]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: codecs: lpass-wsa-macro: remove unnecessary bounds check
authorJonathan Marek <jonathan@marek.ca>
Mon, 17 Nov 2025 05:15:13 +0000 (00:15 -0500)
committerMark Brown <broonie@kernel.org>
Thu, 20 Nov 2025 00:10:57 +0000 (00:10 +0000)
WSA_MACRO_RX0 is 0 and WSA_MACRO_RX_MIX1 is (WSA_MACRO_RX_MAX-1), which
means it is not possible for the bounds check to fail.

Removing the WSA_MACRO_RX_MIX1 limit is needed to add support for other
ports (RX4, RX5, etc.), in which case the valid range depends on the HW
version: rely on the driver only setting valid ports in active_ch_mask
instead (already the case).

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Link: https://patch.msgid.link/20251117051523.16462-1-jonathan@marek.ca
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/lpass-wsa-macro.c

index 3d38c9c213ae2ebff89b70055027d8c61f7280c7..95758ab7a7a88cf499939053d676673c70c97b58 100644 (file)
@@ -1168,12 +1168,6 @@ static int wsa_macro_set_prim_interpolator_rate(struct snd_soc_dai *dai,
 
        for_each_set_bit(port, &wsa->active_ch_mask[dai->id], WSA_MACRO_RX_MAX) {
                int_1_mix1_inp = port;
-               if ((int_1_mix1_inp < WSA_MACRO_RX0) || (int_1_mix1_inp > WSA_MACRO_RX_MIX1)) {
-                       dev_err(component->dev, "%s: Invalid RX port, Dai ID is %d\n",
-                               __func__, dai->id);
-                       return -EINVAL;
-               }
-
                int_mux_cfg0 = CDC_WSA_RX_INP_MUX_RX_INT0_CFG0;
 
                /*
@@ -1220,11 +1214,6 @@ static int wsa_macro_set_mix_interpolator_rate(struct snd_soc_dai *dai,
 
        for_each_set_bit(port, &wsa->active_ch_mask[dai->id], WSA_MACRO_RX_MAX) {
                int_2_inp = port;
-               if ((int_2_inp < WSA_MACRO_RX0) || (int_2_inp > WSA_MACRO_RX_MIX1)) {
-                       dev_err(component->dev, "%s: Invalid RX port, Dai ID is %d\n",
-                               __func__, dai->id);
-                       return -EINVAL;
-               }
 
                int_mux_cfg1 = CDC_WSA_RX_INP_MUX_RX_INT0_CFG1;
                for (j = 0; j < NUM_INTERPOLATORS; j++) {