lib: fwts_cpu: initialize variable, stop coverity warning

Submitted by Colin King on May 6, 2013, 11:11 p.m.

Details

Message ID 1367881860-21357-1-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin King May 6, 2013, 11:11 p.m.
From: Colin Ian King <colin.king@canonical.com>

Coverity CID #997324, Uninitialized scalar variable (UNINIT)

We really don't care about initializing the loop counter as
we are just burning up CPU cycles. But to keep coverity happy
we may as well initialize it.

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

Comments

Alex Hung May 9, 2013, 6:16 a.m.
On 05/07/2013 07:11 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Coverity CID #997324, Uninitialized scalar variable (UNINIT)
>
> We really don't care about initializing the loop counter as
> we are just burning up CPU cycles. But to keep coverity happy
> we may as well initialize it.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_cpu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/lib/src/fwts_cpu.c b/src/lib/src/fwts_cpu.c
> index 282bc42..44711fd 100644
> --- a/src/lib/src/fwts_cpu.c
> +++ b/src/lib/src/fwts_cpu.c
> @@ -385,7 +385,7 @@ int fwts_cpu_performance(
>   static void fwts_cpu_consume_cycles(void)
>   {
>   	signal(SIGUSR1, fwts_cpu_consume_sighandler);
> -	uint64_t i;
> +	uint64_t i = 0;
>
>   	for (;;) {
>   		fwts_cpu_burn_cycles();
>
Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu May 16, 2013, 3:18 a.m.
On 05/07/2013 07:11 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Coverity CID #997324, Uninitialized scalar variable (UNINIT)
>
> We really don't care about initializing the loop counter as
> we are just burning up CPU cycles. But to keep coverity happy
> we may as well initialize it.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_cpu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/lib/src/fwts_cpu.c b/src/lib/src/fwts_cpu.c
> index 282bc42..44711fd 100644
> --- a/src/lib/src/fwts_cpu.c
> +++ b/src/lib/src/fwts_cpu.c
> @@ -385,7 +385,7 @@ int fwts_cpu_performance(
>   static void fwts_cpu_consume_cycles(void)
>   {
>   	signal(SIGUSR1, fwts_cpu_consume_sighandler);
> -	uint64_t i;
> +	uint64_t i = 0;
>
>   	for (;;) {
>   		fwts_cpu_burn_cycles();
>

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

Patch hide | download patch | download mbox

diff --git a/src/lib/src/fwts_cpu.c b/src/lib/src/fwts_cpu.c
index 282bc42..44711fd 100644
--- a/src/lib/src/fwts_cpu.c
+++ b/src/lib/src/fwts_cpu.c
@@ -385,7 +385,7 @@  int fwts_cpu_performance(
 static void fwts_cpu_consume_cycles(void)
 {
 	signal(SIGUSR1, fwts_cpu_consume_sighandler);
-	uint64_t i;
+	uint64_t i = 0;
 
 	for (;;) {
 		fwts_cpu_burn_cycles();