All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jack Yu <jack.yu@realtek.com>
To: Mark Brown <broonie@kernel.org>, Colin Ian King <colin.i.king@gmail.com>
Cc: Oder Chiou <oder_chiou@realtek.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	"linux-sound@vger.kernel.org" <linux-sound@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH][next] ASoC: rt-sdw-common: Fix bit-wise or'ing of values into uninitialized variable ret
Date: Wed, 9 Oct 2024 02:16:26 +0000	[thread overview]
Message-ID: <00bfbc805d9746579129083dafdc1bd0@realtek.com> (raw)
In-Reply-To: <ZwVmCNAVSOgqT6Qd@finisterre.sirena.org.uk>

[-- Attachment #1: Type: text/plain, Size: 969 bytes --]



> -----Original Message-----
> From: Mark Brown <broonie@kernel.org>
> Sent: Wednesday, October 9, 2024 1:04 AM
> To: Colin Ian King <colin.i.king@gmail.com>
> Cc: Oder Chiou <oder_chiou@realtek.com>; Liam Girdwood
> <lgirdwood@gmail.com>; Jaroslav Kysela <perex@perex.cz>; Takashi Iwai
> <tiwai@suse.com>; Jack Yu <jack.yu@realtek.com>;
> linux-sound@vger.kernel.org; kernel-janitors@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH][next] ASoC: rt-sdw-common: Fix bit-wise or'ing of values
> into uninitialized variable ret
> 
> On Tue, Oct 08, 2024 at 05:47:07PM +0100, Colin Ian King wrote:
> > 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.
> 
> I'm very disappinted in the compiler for not noticing this :(

I'm sorry for such mistake. I've sent a patch to fix this yesterday, please refer attachment.

[-- Attachment #2: Type: message/rfc822, Size: 2989 bytes --]

From: Jack Yu <jack.yu@realtek.com>
To: "broonie@kernel.org" <broonie@kernel.org>, "lgirdwood@gmail.com" <lgirdwood@gmail.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>, "lars@metafoo.de" <lars@metafoo.de>, "bard.liao@intel.com" <bard.liao@intel.com>, "naveen.m@intel.com" <naveen.m@intel.com>, "Flove(HsinFu)" <flove@realtek.com>, "Oder Chiou" <oder_chiou@realtek.com>, "Shuming [范書銘]" <shumingf@realtek.com>, "Derek [方德義]" <derek.fang@realtek.com>, "Jack Yu" <jack.yu@realtek.com>
Subject: [PATCH 2/2] ASoC: rt721-sdca: Fix issue of warning message
Date: Tue, 8 Oct 2024 08:57:35 +0000

Fix issue of warning messages caused by some variables.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
---
 sound/soc/codecs/rt-sdw-common.c | 2 +-
 sound/soc/codecs/rt721-sdca.c    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

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
@@ -108,7 +108,7 @@ EXPORT_SYMBOL_GPL(rt_sdca_index_update_bits);
 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;
diff --git a/sound/soc/codecs/rt721-sdca.c b/sound/soc/codecs/rt721-sdca.c
index 36056cb7a3ca..201cb667c8c1 100644
--- a/sound/soc/codecs/rt721-sdca.c
+++ b/sound/soc/codecs/rt721-sdca.c
@@ -30,7 +30,7 @@ static void rt721_sdca_jack_detect_handler(struct work_struct *work)
 {
 	struct rt721_sdca_priv *rt721 =
 		container_of(work, struct rt721_sdca_priv, jack_detect_work.work);
-	int btn_type = 0, ret;
+	int btn_type = 0;
 
 	if (!rt721->hs_jack)
 		return;
@@ -42,7 +42,7 @@ static void rt721_sdca_jack_detect_handler(struct work_struct *work)
 	if (rt721->scp_sdca_stat1 & SDW_SCP_SDCA_INT_SDCA_6) {
 		rt721->jack_type = rt_sdca_headset_detect(rt721->regmap,
 							RT721_SDCA_ENT_GE49);
-		if (ret < 0)
+		if (rt721->jack_type < 0)
 			return;
 	}
 
-- 
2.34.1


      parent reply	other threads:[~2024-10-09  2:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-08 16:47 [PATCH][next] ASoC: rt-sdw-common: Fix bit-wise or'ing of values into uninitialized variable ret Colin Ian King
2024-10-08 17:04 ` Mark Brown
2024-10-08 18:28   ` Dan Carpenter
2024-10-09  2:16   ` Jack Yu [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=00bfbc805d9746579129083dafdc1bd0@realtek.com \
    --to=jack.yu@realtek.com \
    --cc=broonie@kernel.org \
    --cc=colin.i.king@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.