diff mbox

[19/46] cpu: maxfreq: reduce scope of variables

Message ID 1421175905-17035-20-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Jan. 13, 2015, 7:04 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

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

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

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

Comments

Ivan Hu Jan. 15, 2015, 7:32 a.m. UTC | #1
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/maxfreq/maxfreq.c:36]:
> 	(style) The scope of the variable 'val' can be reduced.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/cpu/maxfreq/maxfreq.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/cpu/maxfreq/maxfreq.c b/src/cpu/maxfreq/maxfreq.c
> index a5b3558..0d7bbb9 100644
> --- a/src/cpu/maxfreq/maxfreq.c
> +++ b/src/cpu/maxfreq/maxfreq.c
> @@ -33,9 +33,10 @@
>   static double maxfreq_max(const char *str)
>   {
>   	double max = -1.0;
> -	double val;
>
>   	while (str && *str) {
> +		double val;
> +
>   		while ((*str != '\0') && isspace(*str))
>   			str++;
>
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>
Keng-Yu Lin Jan. 20, 2015, 6:55 a.m. UTC | #2
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/maxfreq/maxfreq.c:36]:
>         (style) The scope of the variable 'val' can be reduced.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/cpu/maxfreq/maxfreq.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/cpu/maxfreq/maxfreq.c b/src/cpu/maxfreq/maxfreq.c
> index a5b3558..0d7bbb9 100644
> --- a/src/cpu/maxfreq/maxfreq.c
> +++ b/src/cpu/maxfreq/maxfreq.c
> @@ -33,9 +33,10 @@
>  static double maxfreq_max(const char *str)
>  {
>         double max = -1.0;
> -       double val;
>
>         while (str && *str) {
> +               double val;
> +
>                 while ((*str != '\0') && isspace(*str))
>                         str++;
>
> --
> 2.1.4
>
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
diff mbox

Patch

diff --git a/src/cpu/maxfreq/maxfreq.c b/src/cpu/maxfreq/maxfreq.c
index a5b3558..0d7bbb9 100644
--- a/src/cpu/maxfreq/maxfreq.c
+++ b/src/cpu/maxfreq/maxfreq.c
@@ -33,9 +33,10 @@ 
 static double maxfreq_max(const char *str)
 {
 	double max = -1.0;
-	double val;
 
 	while (str && *str) {
+		double val;
+
 		while ((*str != '\0') && isspace(*str))
 			str++;