From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6525218EB1; Thu, 30 Apr 2026 01:33:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777512781; cv=none; b=Mc18qdrtf5tUjnGixJUk7BvuYkZ2OMe/qLnNRoaNROruA9OIGK7ZEMS/uFpU+mnaHh3/bmxT5JZtwDS5gj9Pbc65XBDTaWC7+Z3tiaKXbQFUG+jmAdeGae9IJbpNn5cwy6LEoFoxdlYYX8RhBIQsO0Y70oai3VHgPs/yOcy1sT4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777512781; c=relaxed/simple; bh=i7DKF5WFF5Q8Rb2RXIWeQOHBYezeUVKdDpu9M5O4baA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KZtQm6WDVHSFbxIf62szesWIHrYqrgnF3cPLyGxKyxTZGGIz5k6r5w2O3tJbjmVUqH3Z548U9WnU0VKzt9kS2MDjTLUdybSsUum4gzSIY58LA1JEiXIieJd/8vamRlzzcMAOgTkXIilXXRRrze0ErmuWf4IB97FqavGmZJmA7C8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TCszheGi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TCszheGi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75424C19425; Thu, 30 Apr 2026 01:33:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777512780; bh=i7DKF5WFF5Q8Rb2RXIWeQOHBYezeUVKdDpu9M5O4baA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TCszheGiQXAe5yn9Z++veLJzaGL3hmpLbQ2j9862D1S52cj8I7YjTav8ElZG3m5cb rHhbnHNI/3iRADJHi2CUzQHrdFpAG0Ctqvm4itIQk6ta5P6CUjdWwtZ9/NqqsDjVAX 7h0rFmva5K7kKRPxrBFL0N/96zdtbjpvDwZXk1WstBfbknWhmb8K8yfWORAIywTMyV zro0yoKxtlV65BYViiY/MVFOAYbTiXWbGj31jHodVaEU9Zc3HPLu9iOVypOLMwCe9z 5bufqZF1NJfXj8W7Vjs+QN/ms5YX956twT9RBax0+7gkSCCmpYhvbaH1dAkCyA+2n4 7TxHE+hfhboeA== Received: by finisterre.sirena.org.uk (Postfix, from userid 1000) id D77B51AC585D; Thu, 30 Apr 2026 02:32:57 +0100 (BST) Date: Thu, 30 Apr 2026 10:32:57 +0900 From: Mark Brown To: Herve Codina Cc: Bartosz Golaszewski , Linus Walleij , Liam Girdwood , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Saravana Kannan , Jaroslav Kysela , Takashi Iwai , linux-sound@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Christophe Leroy , Thomas Petazzoni Subject: Re: [PATCH v2 14/17] ASoC: simple-amplifier: gpio-audio-amp: Add support for gain-ranges Message-ID: References: <20260429074356.118420-1-herve.codina@bootlin.com> <20260429074356.118420-15-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="shBljPdY0kdTjMii" Content-Disposition: inline In-Reply-To: <20260429074356.118420-15-herve.codina@bootlin.com> X-Cookie: 667: --shBljPdY0kdTjMii Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Apr 29, 2026 at 09:43:50AM +0200, Herve Codina wrote: > +static int *simple_amp_alloc_tlv_ranges(const struct simple_amp_ranges *ranges) > +{ > + unsigned int index; > + unsigned int *tlv; > + return tlv; > +} The function returns a pointer to int but everything else is pointer to unsigned int. > +static int simple_amp_check_new_range(const struct simple_amp_range *new_range, > + const struct simple_amp_range *tab_ranges, > + unsigned int nb_ranges) > +{ > + unsigned int i; > + > + for (i = 0; i < nb_ranges; i++) { > + /* Check for range overlaps */ > + if (new_range->min.gain_db >= tab_ranges[i].min.gain_db && > + new_range->min.gain_db <= tab_ranges[i].max.gain_db) > + return -EINVAL; > + > + if (new_range->max.gain_db >= tab_ranges[i].min.gain_db && > + new_range->max.gain_db <= tab_ranges[i].max.gain_db) > + return -EINVAL; > + } > + return 0; > +} This checks if the new range is inside an existing range but won't notice if the existing range is entirely inside the new one. --shBljPdY0kdTjMii Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmnysUkACgkQJNaLcl1U h9B2Twf/fxpVYs0BPZn9UxEkwvIDkkSmzznKA8O2sjvO1udwM7HugXl/6K72z0In xH0Nf4OgHgC1CmBFXl/+wPx6wcSo5znCGIQCaQMOXaML+MppyDAhrqKgnrpRURZN FWScZpxCAfMK05YVIY8/S7kOUJjdl6bs7uj6Qp4cIB4E8pP0H6T5wQcPi/eBDVo1 52xe7ev5UNfdtarWhBZCdk/T6LPZORXiR+/GeUN2fjbtFUk/NiyXXEPRH7CJkPHN OlcYofp3dR+whzneWR9xl4Ccl2VVzxBfqRx2n8tmmN3qKgVqKXV8418vLiWrFAFh As/6O5vA2NavQCqhFQKZlckdntEVTg== =ClHY -----END PGP SIGNATURE----- --shBljPdY0kdTjMii--