]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: codecs: lpass-wsa-macro: Fix enum kcontrol accesses
authorDawid Wróbel <me@dawidwrobel.com>
Thu, 30 Jul 2026 10:58:13 +0000 (12:58 +0200)
committerMark Brown <broonie@kernel.org>
Sat, 1 Aug 2026 00:01:59 +0000 (01:01 +0100)
EAR SPKR PA Gain" and the four "WSA RX* Mux" controls are enumerated,
but their get and put callbacks access the value through
ucontrol->value.integer.value[0] (a long) instead of
ucontrol->value.enumerated.item[0] (an unsigned int).

This same pattern was fixed in the sibling drivers by
commit bcfe5f76cc40 ("ASoC: codecs: rx-macro: fix accessing array
out of bounds for enum type") and
commit 0ea5eff7c606 ("ASoC: codecs: va-macro: fix accessing array
out of bounds for enum type"), but wsa-macro was missed.

On 64-bit kernels with CONFIG_SND_CTL_DEBUG this trips the elem value
sanity check and every read of these controls fails with -EINVAL.

Fixes: 809bcbcecebf ("ASoC: codecs: lpass-wsa-macro: Add support to WSA Macro")
Fixes: 2c4066e5d428 ("ASoC: codecs: lpass-wsa-macro: add dapm widgets and route")
Assisted-by: Claude:claude-fable-5
Cc: stable@vger.kernel.org
Signed-off-by: Dawid Wróbel <me@dawidwrobel.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Link: https://patch.msgid.link/20260730-worktree-lpass-tx-macro-enum-fix-v2-2-6d091c736116@dawidwrobel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/lpass-wsa-macro.c

index 5ad0448af649da09f818b657d09327c86106063c..af521e0988db09e5c23e7e989b0eb6238efe556a 100644 (file)
@@ -2064,7 +2064,7 @@ static int wsa_macro_ear_spkr_pa_gain_get(struct snd_kcontrol *kcontrol,
        struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
 
-       ucontrol->value.integer.value[0] = wsa->ear_spkr_gain;
+       ucontrol->value.enumerated.item[0] = wsa->ear_spkr_gain;
 
        return 0;
 }
@@ -2075,7 +2075,7 @@ static int wsa_macro_ear_spkr_pa_gain_put(struct snd_kcontrol *kcontrol,
        struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
        struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
 
-       wsa->ear_spkr_gain =  ucontrol->value.integer.value[0];
+       wsa->ear_spkr_gain =  ucontrol->value.enumerated.item[0];
 
        return 0;
 }
@@ -2088,7 +2088,7 @@ static int wsa_macro_rx_mux_get(struct snd_kcontrol *kcontrol,
                                snd_soc_dapm_to_component(widget->dapm);
        struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
 
-       ucontrol->value.integer.value[0] =
+       ucontrol->value.enumerated.item[0] =
                        wsa->rx_port_value[widget->shift];
        return 0;
 }
@@ -2101,7 +2101,7 @@ static int wsa_macro_rx_mux_put(struct snd_kcontrol *kcontrol,
                                snd_soc_dapm_to_component(widget->dapm);
        struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
        struct snd_soc_dapm_update *update = NULL;
-       u32 rx_port_value = ucontrol->value.integer.value[0];
+       u32 rx_port_value = ucontrol->value.enumerated.item[0];
        u32 bit_input;
        u32 aif_rst;
        unsigned int dai_id;