From: Dan Carpenter <error27@gmail.com>
To: Val Packett <val@packett.cool>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
Luca Weiss <luca.weiss@fairphone.com>,
Charles Keepax <ckeepax@opensource.cirrus.com>,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] ASoC: codecs: aw88261: small cleanup in aw88261_set_tdm_slot()
Date: Thu, 1 Oct 2026 09:51:39 +0300 [thread overview]
Message-ID: <ar4C-0NIYXiAvxvv@stanley.mountain> (raw)
This code triggers a Smatch false positive:
sound/soc/codecs/aw88261.c:858 aw88261_set_tdm_slot()
error: uninitialized symbol 'chan'.
This would only happen if both the tx and rx masks were zero which is
a nonsense scenario and reviewing the callers shows that it never
happens.
However, if the rx_mask is zero then we're comparing the mask from RX
against the chan from TX which is confusing:
if ((rx_mask & ~BIT(chan)) != 0) {
^^ rx ^^^^ tx chan
Of course, in that case the condition is going to be false because
the rx_mask is zero. So it's fine. But it would be more clear to move
the condition inside the if statement and it silences the static checker
warning as well.
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
From code review. Untested.
sound/soc/codecs/aw88261.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/aw88261.c b/sound/soc/codecs/aw88261.c
index b8d06534bc8f..8671069f4c18 100644
--- a/sound/soc/codecs/aw88261.c
+++ b/sound/soc/codecs/aw88261.c
@@ -853,13 +853,13 @@ static int aw88261_set_tdm_slot(struct snd_soc_dai *dai,
return -EINVAL;
aw88261->rxl_slotvld_mask = chan << AW88261_I2S_RXL_SLOTVLD_START_BIT;
- }
- if ((rx_mask & ~BIT(chan)) != 0) {
- if ((chan = __ffs(rx_mask & ~BIT(chan))) > 16)
- return -EINVAL;
+ if ((rx_mask & ~BIT(chan)) != 0) {
+ if ((chan = __ffs(rx_mask & ~BIT(chan))) > 16)
+ return -EINVAL;
- aw88261->rxr_slotvld_mask = chan << AW88261_I2S_RXR_SLOTVLD_START_BIT;
+ aw88261->rxr_slotvld_mask = chan << AW88261_I2S_RXR_SLOTVLD_START_BIT;
+ }
}
return 0;
--
2.53.0
next reply other threads:[~2026-10-01 6:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 6:51 Dan Carpenter [this message]
2026-10-02 11:26 ` Mark Brown
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=ar4C-0NIYXiAvxvv@stanley.mountain \
--to=error27@gmail.com \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=luca.weiss@fairphone.com \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=val@packett.cool \
/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®