From: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
To: Colin Ian King <colin.i.king@gmail.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
linux-sound@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] ASoC: codecs: wcd: Fix a less than zero check on an u32 array element
Date: Wed, 24 Sep 2025 11:37:58 +0100 [thread overview]
Message-ID: <4ec6bf87-f6c8-4080-98c2-e81425c44e4a@oss.qualcomm.com> (raw)
In-Reply-To: <20250924103334.9832-1-colin.i.king@gmail.com>
On 9/24/25 11:33 AM, Colin Ian King wrote:
> Currently the error check from the call to wcd_get_micbias_val is always
> false because an u32 unsigned int in common->micb_vout[i] is being used to
> to perform the less than zero error check. Fix this by using the int
> variable ret to perform the check.
>
> Fixes: 4f16b6351bbf ("ASoC: codecs: wcd: add common helper for wcd codecs")
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
Dan Carpenter sent exactly same fix yesterday:
https://www.spinics.net/lists/kernel/msg5855359.html
--srini
> sound/soc/codecs/wcd-common.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/codecs/wcd-common.c b/sound/soc/codecs/wcd-common.c
> index 9bbfda828377..9fd3965ed540 100644
> --- a/sound/soc/codecs/wcd-common.c
> +++ b/sound/soc/codecs/wcd-common.c
> @@ -65,9 +65,12 @@ int wcd_dt_parse_micbias_info(struct wcd_common *common)
> int i;
>
> for (i = 0; i < common->max_bias; i++) {
> - common->micb_vout[i] = wcd_get_micbias_val(common->dev, i + 1, &common->micb_mv[i]);
> - if (common->micb_vout[i] < 0)
> + int ret;
> +
> + ret = wcd_get_micbias_val(common->dev, i + 1, &common->micb_mv[i]);
> + if (ret < 0)
> return -EINVAL;
> + common->micb_vout[i] = ret;
> }
>
> return 0;
prev parent reply other threads:[~2025-09-24 10:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-24 10:33 Colin Ian King
2025-09-24 10:37 ` Srinivas Kandagatla [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ec6bf87-f6c8-4080-98c2-e81425c44e4a@oss.qualcomm.com \
--to=srinivas.kandagatla@oss.qualcomm.com \
--cc=broonie@kernel.org \
--cc=colin.i.king@gmail.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®