[PATCH 21/46] cpu: msr: reduce scope of variables

Colin King colin.king at canonical.com
Tue Jan 13 19:04:40 UTC 2015


From: Colin Ian King <colin.king at canonical.com>

cppcheck is picking up some minor style issues which can
be easily fixed:

[src/cpu/msr/msr.c:123]:
	(style) The scope of the variable 'cpu' can be reduced.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/cpu/msr/msr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/cpu/msr/msr.c b/src/cpu/msr/msr.c
index 0d04007..e2acce3 100644
--- a/src/cpu/msr/msr.c
+++ b/src/cpu/msr/msr.c
@@ -120,7 +120,6 @@ static int msr_consistent_check(fwts_framework *fw,
 	uint64_t *vals;
 	bool *inconsistent;
 	int inconsistent_count;
-	int cpu;
 
 	if ((vals = calloc(ncpus, sizeof(uint64_t))) == NULL) {
 		fwts_log_error(fw, "Out of memory allocating msr value buffers.");
@@ -138,6 +137,8 @@ static int msr_consistent_check(fwts_framework *fw,
 		return FWTS_ERROR;
 	}
 	if (inconsistent_count > 0) {
+		int cpu;
+
 		fwts_failed(fw, level, "MSRCPUsInconsistent",
 			"MSR 0x%8.8" PRIx32 " %s has %d inconsistent values across "
 			"%d CPUs (shift: %d mask: 0x%" PRIx64 ").",
-- 
2.1.4




More information about the fwts-devel mailing list