summaryrefslogtreecommitdiff
path: root/sound/soc/meson/g12a-toacodec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/meson/g12a-toacodec.c')
-rw-r--r--sound/soc/meson/g12a-toacodec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/soc/meson/g12a-toacodec.c b/sound/soc/meson/g12a-toacodec.c
index 6c4503766fdc..dd7f07de2685 100644
--- a/sound/soc/meson/g12a-toacodec.c
+++ b/sound/soc/meson/g12a-toacodec.c
@@ -71,6 +71,9 @@ static int g12a_toacodec_mux_put_enum(struct snd_kcontrol *kcontrol,
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
unsigned int mux, reg;
+ if (ucontrol->value.enumerated.item[0] >= e->items)
+ return -EINVAL;
+
mux = snd_soc_enum_item_to_val(e, ucontrol->value.enumerated.item[0]);
regmap_field_read(priv->field_dat_sel, &reg);