Messages in this thread | | | Date | Tue, 13 Jun 2017 19:00:01 +0100 | From | Mark Brown <> | Subject | Re: [PATCH v3] ASoC: sgtl5000: add avc support |
| |
On Tue, Jun 13, 2017 at 08:57:34AM +0200, Richard Leitner wrote:
> +static int avc_put_threshold(struct snd_kcontrol *kcontrol, > + struct snd_ctl_elem_value *ucontrol) > +{ > + struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); > + int db; > + u16 reg; > + > + db = clamp((int)ucontrol->value.integer.value[0], 0, 96); > + reg = avc_thr_db2reg[db]; > + snd_soc_write(codec, SGTL5000_DAP_AVC_THRESHOLD, reg);
This should reject rather than silently accept out of bounds values, otherwise this looks good. [unhandled content-type:application/pgp-signature] | |