mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Colin Ian King <colin.i.king@gmail.com>
To: Oder Chiou <oder_chiou@realtek.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>, Jack Yu <jack.yu@realtek.com>,
	linux-sound@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH][next] ASoC: rt-sdw-common: Fix bit-wise or'ing of values into uninitialized variable ret
Date: Tue,  8 Oct 2024 17:47:07 +0100	[thread overview]
Message-ID: <20241008164707.203792-1-colin.i.king@gmail.com> (raw)

There are a handful of bit-wise or'ing of values into the uninitialized
variable ret resulting in garbage results. Fix this by ininitializing
ret to zero.

Fixes: bbca8e7050e0 ("ASoC: rt-sdw-common: Common functions for Realtek soundwire driver")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 sound/soc/codecs/rt-sdw-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt-sdw-common.c b/sound/soc/codecs/rt-sdw-common.c
index 9ed0e9855699..a422da6cf702 100644
--- a/sound/soc/codecs/rt-sdw-common.c
+++ b/sound/soc/codecs/rt-sdw-common.c
@@ -101,21 +101,21 @@ EXPORT_SYMBOL_GPL(rt_sdca_index_update_bits);
  * rt_sdca_btn_type - Decision of button type.
  *
  * @buffer: UMP message buffer.
  *
  * A button type will be returned regarding to buffer,
  * it returns zero if buffer cannot be recognized.
  */
 int rt_sdca_btn_type(unsigned char *buffer)
 {
 	u8 btn_type = 0;
-	int ret;
+	int ret = 0;
 
 	btn_type |= buffer[0] & 0xf;
 	btn_type |= (buffer[0] >> 4) & 0xf;
 	btn_type |= buffer[1] & 0xf;
 	btn_type |= (buffer[1] >> 4) & 0xf;
 
 	if (btn_type & BIT(0))
 		ret |= SND_JACK_BTN_2;
 	if (btn_type & BIT(1))
 		ret |= SND_JACK_BTN_3;
-- 
2.39.5


             reply	other threads:[~2024-10-08 16:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-08 16:47 Colin Ian King [this message]
2024-10-08 17:04 ` Mark Brown
2024-10-08 18:28   ` Dan Carpenter
2024-10-09  2:16   ` Jack Yu

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=20241008164707.203792-1-colin.i.king@gmail.com \
    --to=colin.i.king@gmail.com \
    --cc=broonie@kernel.org \
    --cc=jack.yu@realtek.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=oder_chiou@realtek.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /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®