Thread (6 messages) 6 messages, 2 authors, 2019-09-17
STALE2449d

[PATCH 3/4] rt-tests: cyclictest: Fix warning: ‘cpu’ may be used uninitialized

From: John Kacur <jkacur@redhat.com>
Date: 2019-09-16 21:51:28
Subsystem: the rest · Maintainer: Linus Torvalds

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 45b6041ec1c9..542e85c27a25 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help