From 0b07c560f7b2f813e31499df58290008584271b5 Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Tue, 7 May 2019 05:48:47 +0900 Subject: [PATCH] axfer/test: fix uninitialized warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This commit fixes uninitialized return value from a call of test_mux() and text_demux() to suppress warnings below: $ make check ... gcc -DHAVE_CONFIG_H -I. -I../../include -O2 -Wall -pipe -g -MT mapper-test.o -MD -MP -MF .deps/mapper-test.Tpo -c -o mapper-test.o mapper-test.c mapper-test.c: In function ‘test_mapper’: mapper-test.c:241:9: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized] return err; ^~~ mapper-test.c:231:5: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized] if (err < 0) ^ Fixes: 39d1ab8a0cb4: ('axfer: add a unit test for mapper interface') Signed-off-by: Takashi Sakamoto Signed-off-by: Jaroslav Kysela --- axfer/test/mapper-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/axfer/test/mapper-test.c b/axfer/test/mapper-test.c index 3dfcf50..6b24d54 100644 --- a/axfer/test/mapper-test.c +++ b/axfer/test/mapper-test.c @@ -71,7 +71,7 @@ static int test_demux(struct mapper_trial *trial, snd_pcm_access_t access, unsigned int bytes_per_sample; uint64_t total_frame_count; int i; - int err; + int err = 0; for (i = 0; i < cntr_count; ++i) { snd_pcm_format_t format; @@ -163,7 +163,7 @@ static int test_mux(struct mapper_trial *trial, snd_pcm_access_t access, unsigned int bytes_per_sample; uint64_t total_frame_count; int i; - int err; + int err = 0; for (i = 0; i < cntr_count; ++i) { snd_pcm_format_t format; -- 2.47.1