lkml.org 
[lkml]   [2020]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] ASoC: soc-core: fix an uninitialized use
Date
Fixed the uninitialized use of a signed integer variable ret in
soc_probe_component when all its definitions are not executed. This
caused -ftrivial-auto-var-init=pattern to initialize the variable to
repeated 0xAA (i.e. a negative value) and triggered the following code
unintentionally.

err_probe:
if (ret < 0)
soc_cleanup_component(component);

Signed-off-by: Jian Cai <caij2003@gmail.com>
---
sound/soc/soc-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 068d809c349a..bfb813ba34f3 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1180,7 +1180,7 @@ static int soc_probe_component(struct snd_soc_card *card,
snd_soc_component_get_dapm(component);
struct snd_soc_dai *dai;
int probed = 0;
- int ret;
+ int ret = 0;

if (!strcmp(component->name, "snd-soc-dummy"))
return 0;
--
2.25.0.341.g760bfbb309-goog
\
 
 \ /
  Last update: 2020-02-06 21:05    [W:0.161 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site