There is a possibility for an uninitialized *ret* variable to be
returned in some code paths.

Setting to 0 prevents a random value from being returned.

Closes: 
https://scan5.scan.coverity.com/#/project-view/63873/10063?selectedIssue=1627120
Signed-off-by: Ethan Carter Edwards <et...@ethancedwards.com>
---
Would it potentially be better to remove ret entirely and just return 0
explicitly at the end of the function and directly return in the if
statements? I'm not sure.
---
 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 
0538c252ba69b1f5a24ba2de2a610b22d0c0665f..61a00a3548d85689c13e2d2a301da17a572e4a0e
 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 = 0;
        int i;
 
        rt_amp_map = get_codec_name_and_route(dai, codec_name);

---
base-commit: febbc555cf0fff895546ddb8ba2c9a523692fb55
change-id: 20250210-soc_sdw_rt_amp-e9c703ebe4dc

Best regards,
-- 
Ethan Carter Edwards <et...@ethancedwards.com>


Reply via email to