Patchwork [1/6] vl.c: Remove dead assignment

login
register
mail settings
Submitter Amit Shah
Date Jan. 13, 2010, 10:54 a.m.
Message ID <1263380087-31821-2-git-send-email-amit.shah@redhat.com>
Download mbox | patch
Permalink /patch/42802/
State New
Headers show

Comments

Amit Shah - Jan. 13, 2010, 10:54 a.m.
clang-analyzer pointed out the value of 'sockets' is never reused.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
CC: Andre Przywara <andre.przywara@amd.com>
---
 vl.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
Anthony Liguori - Jan. 13, 2010, 11:27 p.m.
On 01/13/2010 04:54 AM, Amit Shah wrote:
> clang-analyzer pointed out the value of 'sockets' is never reused.
>
> Signed-off-by: Amit Shah<amit.shah@redhat.com>
> CC: Andre Przywara<andre.przywara@amd.com>
>    

Applied.  Thanks.

Regards,

Anthony Liguori
> ---
>   vl.c |    6 +-----
>   1 files changed, 1 insertions(+), 5 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index b048e89..e49e7bd 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2613,17 +2613,13 @@ static void smp_parse(const char *optarg)
>           threads = threads>  0 ? threads : 1;
>           if (smp == 0) {
>               smp = cores * threads * sockets;
> -        } else {
> -            sockets = smp / (cores * threads);
>           }
>       } else {
>           if (cores == 0) {
>               threads = threads>  0 ? threads : 1;
>               cores = smp / (sockets * threads);
>           } else {
> -            if (sockets == 0) {
> -                sockets = smp / (cores * threads);
> -            } else {
> +            if (sockets) {
>                   threads = smp / (cores * sockets);
>               }
>           }
>

Patch

diff --git a/vl.c b/vl.c
index b048e89..e49e7bd 100644
--- a/vl.c
+++ b/vl.c
@@ -2613,17 +2613,13 @@  static void smp_parse(const char *optarg)
         threads = threads > 0 ? threads : 1;
         if (smp == 0) {
             smp = cores * threads * sockets;
-        } else {
-            sockets = smp / (cores * threads);
         }
     } else {
         if (cores == 0) {
             threads = threads > 0 ? threads : 1;
             cores = smp / (sockets * threads);
         } else {
-            if (sockets == 0) {
-                sockets = smp / (cores * threads);
-            } else {
+            if (sockets) {
                 threads = smp / (cores * sockets);
             }
         }