Patchwork [6/8] cpu: cpufreq: tidy up memset usage

login
register
mail settings
Submitter Colin King
Date July 23, 2012, 1:02 p.m.
Message ID <1343048578-13332-7-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/172665/
State Accepted
Headers show

Comments

Colin King - July 23, 2012, 1:02 p.m.
From: Colin Ian King <colin.king@canonical.com>

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/cpu/cpufreq/cpufreq.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Keng-Yu Lin - July 25, 2012, 7:27 a.m.
On Mon, Jul 23, 2012 at 9:02 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/cpu/cpufreq/cpufreq.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
> index 014d31c..f4a461b 100644
> --- a/src/cpu/cpufreq/cpufreq.c
> +++ b/src/cpu/cpufreq/cpufreq.c
> @@ -217,7 +217,6 @@ static unsigned long get_performance_repeat(fwts_framework *fw,
>  static char *HzToHuman(unsigned long hz)
>  {
>         static char buffer[1024];
> -       memset(buffer, 0, 1024);
>         unsigned long long Hz;
>
>         Hz = hz;
> @@ -267,7 +266,7 @@ static void do_cpu(fwts_framework *fw, int cpu)
>         unsigned long cpu_top_speed = 0;
>
>         memset(freqs, 0, sizeof(freqs));
> -       memset(line, 0, 4096);
> +       memset(line, 0, sizeof(line));
>
>         set_governor(fw, cpu);
>
> --
> 1.7.10.4
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Ivan Hu - July 25, 2012, 8:03 a.m.
On 07/23/2012 09:02 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/cpu/cpufreq/cpufreq.c |    3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
> index 014d31c..f4a461b 100644
> --- a/src/cpu/cpufreq/cpufreq.c
> +++ b/src/cpu/cpufreq/cpufreq.c
> @@ -217,7 +217,6 @@ static unsigned long get_performance_repeat(fwts_framework *fw,
>   static char *HzToHuman(unsigned long hz)
>   {
>   	static char buffer[1024];
> -	memset(buffer, 0, 1024);
>   	unsigned long long Hz;
>
>   	Hz = hz;
> @@ -267,7 +266,7 @@ static void do_cpu(fwts_framework *fw, int cpu)
>   	unsigned long cpu_top_speed = 0;
>
>   	memset(freqs, 0, sizeof(freqs));
> -	memset(line, 0, 4096);
> +	memset(line, 0, sizeof(line));
>
>   	set_governor(fw, cpu);
>
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch

diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
index 014d31c..f4a461b 100644
--- a/src/cpu/cpufreq/cpufreq.c
+++ b/src/cpu/cpufreq/cpufreq.c
@@ -217,7 +217,6 @@  static unsigned long get_performance_repeat(fwts_framework *fw,
 static char *HzToHuman(unsigned long hz)
 {
 	static char buffer[1024];
-	memset(buffer, 0, 1024);
 	unsigned long long Hz;
 
 	Hz = hz;
@@ -267,7 +266,7 @@  static void do_cpu(fwts_framework *fw, int cpu)
 	unsigned long cpu_top_speed = 0;
 
 	memset(freqs, 0, sizeof(freqs));
-	memset(line, 0, 4096);
+	memset(line, 0, sizeof(line));
 
 	set_governor(fw, cpu);