[PATCH 20/46] cpu: microcode: reduce scope of variables

Colin King colin.king at canonical.com
Tue Jan 13 19:04:39 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/microcode/microcode.c:203]:
	(style) The scope of the variable 'path' can be reduced.
[src/cpu/microcode/microcode.c:204]:
	(style) The scope of the variable 'data' can be reduced.

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

diff --git a/src/cpu/microcode/microcode.c b/src/cpu/microcode/microcode.c
index d493168..b541b87 100644
--- a/src/cpu/microcode/microcode.c
+++ b/src/cpu/microcode/microcode.c
@@ -200,13 +200,13 @@ static int microcode_test1(fwts_framework *fw)
 
 	/* Scan and check */
 	while ((entry = readdir(dir)) != NULL) {
-		char path[PATH_MAX];
-		char *data;
-
 	        if (entry &&
 		    (strlen(entry->d_name) > 3) &&
 		    (strncmp(entry->d_name,"cpu", 3) == 0) &&
 		    (isdigit(entry->d_name[3]))) {
+			char path[PATH_MAX];
+			char *data;
+
 	        	snprintf(path, sizeof(path),
 				SYS_CPU_PATH "/%s/microcode/version",
 				entry->d_name);
-- 
2.1.4




More information about the fwts-devel mailing list