[PATCH] cpu: cpufreq: reduce scope of variable 'i'

Colin King colin.king at canonical.com
Wed Aug 17 10:13:24 UTC 2016


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

Minor change to fix cppcheck style warnings, no functional change

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

diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
index 7216364..2d30c2a 100644
--- a/src/cpu/cpufreq/cpufreq.c
+++ b/src/cpu/cpufreq/cpufreq.c
@@ -749,7 +749,7 @@ static int parse_cpu_info(fwts_framework *fw,
 {
 	char *end, path[PATH_MAX+1], *str, *tmp;
 	struct stat statbuf;
-	int i, rc;
+	int rc;
 
 	strcpy(cpu->sysfs_path, dir->d_name);
 	cpu->idx = strtoul(cpu->sysfs_path + strlen("cpu"), &end, 10);
@@ -783,7 +783,9 @@ static int parse_cpu_info(fwts_framework *fw,
 
 	/* cpu driver like intel_pstate has no scaling_available_frequencies */
 	if (str != NULL) {
-		for (tmp = str, i = 0; ; tmp = NULL) {
+		int i = 0;
+
+		for (tmp = str; ; tmp = NULL) {
 			char *tok = strtok(tmp, " ");
 			if (!tok)
 				break;
-- 
2.8.1




More information about the fwts-devel mailing list