Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753877AbdFMSAg (ORCPT ); Tue, 13 Jun 2017 14:00:36 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:36176 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753810AbdFMSAU (ORCPT ); Tue, 13 Jun 2017 14:00:20 -0400 Date: Tue, 13 Jun 2017 19:00:01 +0100 From: Mark Brown To: Richard Leitner Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, clemens.gruber@pqgruber.com, eric@nelint.com, fabio.estevam@nxp.com, kalle.kankare@vincit.fi, dev@g0hl1n.net Message-ID: <20170613180001.uh6mfhr55vgquvps@sirena.org.uk> References: <1497337054-4911-1-git-send-email-richard.leitner@skidata.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3nzu7tob46rndg5j" Content-Disposition: inline In-Reply-To: <1497337054-4911-1-git-send-email-richard.leitner@skidata.com> X-Cookie: dpkg has bugs? no way! User-Agent: NeoMutt/20170306 (1.8.0) X-SA-Exim-Connect-IP: 2001:470:1f1d:6b5::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Re: [PATCH v3] ASoC: sgtl5000: add avc support X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1207 Lines: 37 --3nzu7tob46rndg5j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. --3nzu7tob46rndg5j Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAllAKCAACgkQJNaLcl1U h9A4BAf/bZp4nyOwr7DfB97gJGcTj6Ac1x8+7Lz90dO2IWFMKov0N0uzjgqT+KU8 Npi2Bl3dUKHOcryg6V3q0ooPuiBRnxf/TXIpZiws1M+us2oa91ex3x8c7u2dD4Aq NhejssXgOX6fwIB8D0zTi+75mGLgstK9oanANp9FnfDVwMMh9bZlgwdHkgF5cCyg tQQhnf+RwSPLmwfJBde3wagGqt8QLl/+rTw4VDXBDJNV+OrSOawSz/fJ1pWhGYOo SdnnidaEDIP4+9eW/GbtxYIANXjw5dI80LE1oXrgqhJpy0DVvZb3ZPa3b1ULLluQ pWvLVWZvDV++c0zjZ0oJ9kfd+oRpOA== =vvRO -----END PGP SIGNATURE----- --3nzu7tob46rndg5j--