rt-tests/SOURCES/rt-tests-cyclictest-Fix-warning-cpu-may-be-used-uninitialized.patch
2021-10-08 16:30:49 +00:00

34 lines
1.1 KiB
Diff

From f70d5f0de62114cfcd8d8b5032138111730665e6 Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Mon, 16 Sep 2019 21:06:28 +0200
Subject: [PATCH 4/8] =?UTF-8?q?rt-tests:=20cyclictest:=20Fix=20=20warning:?=
=?UTF-8?q?=20=E2=80=98cpu=E2=80=99=20may=20be=20used=20uninitialized?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fix warning 'cpu' maybe uninitialized by giving it a default value in
the switch statement. Note, this is a false positive, but documenting
the default value in the switch statement isn't a bad thing.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/cyclictest/cyclictest.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 72fb35da3238..3a78912b34f8 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1897,6 +1897,7 @@ int main(int argc, char **argv)
printf("Thread %d using cpu %d.\n", i, cpu);
break;
case AFFINITY_USEALL: cpu = i % max_cpus; break;
+ default: cpu = -1;
}
node = -1;
--
2.20.1