Message ID | 1421175905-17035-19-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 01/14/2015 03:04 AM, Colin King wrote: > From: Colin Ian King <colin.king@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@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; > Acked-by: Ivan Hu <ivan.hu@canonical.com>
On Wed, Jan 14, 2015 at 3:04 AM, Colin King <colin.king@canonical.com> wrote: > From: Colin Ian King <colin.king@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@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 > > Acked-by: Keng-Yu Lin <kengyu@canonical.com>
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;