[PATCH 18/46] cpu: cpufreq: reduce scope of variables
Colin King
colin.king at canonical.com
Tue Jan 13 19:04:37 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/cpufreq/cpufreq.c:447]:
(style) The scope of the variable 'Hz' can be reduced.
[src/cpu/cpufreq/cpufreq.c:476]:
(style) The scope of the variable 'Hz' can be reduced.
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/cpu/cpufreq/cpufreq.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
index 0fcab88..d3e19ef 100644
--- a/src/cpu/cpufreq/cpufreq.c
+++ b/src/cpu/cpufreq/cpufreq.c
@@ -444,7 +444,7 @@ static void lowest_speed(fwts_framework *fw, const int cpu)
char path[PATH_MAX];
char *line;
char *c, *c2;
- uint64_t Hz, lowspeed = 0;
+ uint64_t lowspeed = 0;
cpu_mkpath(path, sizeof(path), cpu, "scaling_available_frequencies");
if ((line = fwts_get(path)) == NULL)
@@ -452,6 +452,8 @@ static void lowest_speed(fwts_framework *fw, const int cpu)
c = line;
while (c && strlen(c) > 1) {
+ uint64_t Hz;
+
c2 = strchr(c, ' ');
if (c2) {
*c2 = 0;
@@ -473,7 +475,6 @@ static void highest_speed(fwts_framework *fw, const int cpu)
{
char path[PATH_MAX];
char *line;
- uint64_t Hz;
char *c, *c2;
unsigned long highspeed=0;
@@ -483,6 +484,8 @@ static void highest_speed(fwts_framework *fw, const int cpu)
c = line;
while (c && strlen(c) > 1) {
+ uint64_t Hz;
+
c2 = strchr(c, ' ');
if (c2) {
*c2=0;
--
2.1.4
More information about the fwts-devel
mailing list