From: I Hsin Cheng <richard120310@gmail.com>
To: lgirdwood@gmail.com
Cc: broonie@kernel.org, perex@perex.cz, tiwai@suse.com,
pierre-louis.bossart@linux.dev, yung-chuan.liao@linux.intel.com,
Vijendar.Mukunda@amd.com, peter.ujfalusi@linux.intel.com,
peterz@infradead.org, christophe.jaillet@wanadoo.fr,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
skhan@linuxfoundation.org, I Hsin Cheng <richard120310@gmail.com>
Subject: [RFC PATCH] ASoC: intel/sdw_utils: Assign initial value in asoc_sdw_rt_amp_spk_rtd_init()
Date: Mon, 5 May 2025 15:41:42 +0800 [thread overview]
Message-ID: <20250505074142.615408-1-richard120310@gmail.com> (raw)
If strstr() for codec_dai->component->name_prefix doesn't find "-1" nor
"-2", the value of ret will remain uninitialized. Initialized it with
"-EINVAL" representing the component name prefix inside "rtd" is
invalid.
If "->name_prefix" is guaranteed to have either "-1" or "-2", we can
remove the second strstr() because we know if "-1" is not in
"->name_prefix", then "-2" is in there. It'll be a waste to do one more
strstr() in that case.
Link: https://scan5.scan.coverity.com/#/project-view/36179/10063?selectedIssue=1627120
Signed-off-by: I Hsin Cheng <richard120310@gmail.com>
---
sound/soc/sdw_utils/soc_sdw_rt_amp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/sdw_utils/soc_sdw_rt_amp.c b/sound/soc/sdw_utils/soc_sdw_rt_amp.c
index 0538c252ba69..83c2368170cb 100644
--- a/sound/soc/sdw_utils/soc_sdw_rt_amp.c
+++ b/sound/soc/sdw_utils/soc_sdw_rt_amp.c
@@ -190,7 +190,7 @@ int asoc_sdw_rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc
const struct snd_soc_dapm_route *rt_amp_map;
char codec_name[CODEC_NAME_SIZE];
struct snd_soc_dai *codec_dai;
- int ret;
+ int ret = -EINVAL;
int i;
rt_amp_map = get_codec_name_and_route(dai, codec_name);
--
2.43.0
next reply other threads:[~2025-05-05 7:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-05 7:41 I Hsin Cheng [this message]
2025-05-05 8:27 ` [RFC PATCH] ASoC: intel/sdw_utils: Assign initial value in asoc_sdw_rt_amp_spk_rtd_init() Liao, Bard
2025-05-05 12:46 ` I Hsin Cheng
2025-05-05 12:58 ` Liao, Bard
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=20250505074142.615408-1-richard120310@gmail.com \
--to=richard120310@gmail.com \
--cc=Vijendar.Mukunda@amd.com \
--cc=broonie@kernel.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.com \
--cc=peterz@infradead.org \
--cc=pierre-louis.bossart@linux.dev \
--cc=skhan@linuxfoundation.org \
--cc=tiwai@suse.com \
--cc=yung-chuan.liao@linux.intel.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