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>,
"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 v2] ASoC: rt-sdw-common: Enhance switch case to prevent uninitialized variable
Date: Mon, 14 Oct 2024 09:55:20 +0000 [thread overview]
Message-ID: <8631337239d744088d56caab2d8f39cb@realtek.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 908 bytes --]
If det_mode is not 0, 3 or 5 then function will return
jack_type with an uninitialzed value.
Enhance switch case to prevent uninitialized variable issue.
Signed-off-by: Jack Yu <jack.yu@realtek.com>
---
sound/soc/codecs/rt-sdw-common.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/rt-sdw-common.c b/sound/soc/codecs/rt-sdw-common.c
index a422da6cf702..9f51fec383f9 100644
--- a/sound/soc/codecs/rt-sdw-common.c
+++ b/sound/soc/codecs/rt-sdw-common.c
@@ -150,15 +150,15 @@ int rt_sdca_headset_detect(struct regmap *map, unsigned int entity_id)
goto io_error;
switch (det_mode) {
- case 0x00:
- jack_type = 0;
- break;
case 0x03:
jack_type = SND_JACK_HEADPHONE;
break;
case 0x05:
jack_type = SND_JACK_HEADSET;
break;
+ default:
+ jack_type = 0;
+ break;
}
/* write selected_mode */
--
2.34.1
[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 5546 bytes --]
next reply other threads:[~2024-10-14 9:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-14 9:55 Jack Yu [this message]
2024-10-14 16:22 ` [PATCH v2] ASoC: rt-sdw-common: Enhance switch case to prevent uninitialized variable 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=8631337239d744088d56caab2d8f39cb@realtek.com \
--to=jack.yu@realtek.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=derek.fang@realtek.com \
--cc=flove@realtek.com \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=oder_chiou@realtek.com \
--cc=shumingf@realtek.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