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.

Attachment: signature.asc
Description: PGP signature

Reply via email to