]> xenbits.xensource.com Git - xen.git/commitdiff
x86/Viridian: drop dead variable updates
authorJan Beulich <jbeulich@suse.com>
Wed, 24 Nov 2021 10:10:36 +0000 (11:10 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 24 Nov 2021 10:10:36 +0000 (11:10 +0100)
Both hvcall_flush_ex() and hvcall_ipi_ex() update "size" without
subsequently using the value; future compilers may warn about such.
Alongside dropping the updates, shrink the variables' scopes to
demonstrate that there are no outer scope uses.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul@xen.org>
xen/arch/x86/hvm/viridian/viridian.c

index 7d1cfc530bad36bd1ae194e64b919df574e14858..efdd60b205a707c3175c0bca2274320c443ae573 100644 (file)
@@ -776,7 +776,6 @@ static int hvcall_flush_ex(const union hypercall_input *input,
     {
         union hypercall_vpset *vpset = &this_cpu(hypercall_vpset);
         struct hv_vpset *set = &vpset->set;
-        size_t size;
         int rc;
 
         *set = input_params.set;
@@ -784,8 +783,7 @@ static int hvcall_flush_ex(const union hypercall_input *input,
         {
             unsigned long offset = offsetof(typeof(input_params),
                                             set.bank_contents);
-
-            size = sizeof(*set->bank_contents) * hv_vpset_nr_banks(set);
+            size_t size = sizeof(*set->bank_contents) * hv_vpset_nr_banks(set);
 
             if ( offsetof(typeof(*vpset), set.bank_contents[0]) + size >
                  sizeof(*vpset) )
@@ -798,11 +796,7 @@ static int hvcall_flush_ex(const union hypercall_input *input,
                                           input_params_gpa + offset,
                                           size) != HVMTRANS_okay)
                 return -EINVAL;
-
-            size += sizeof(*set);
         }
-        else
-            size = sizeof(*set);
 
         rc = hv_vpset_to_vpmask(set, vpmask);
         if ( rc )
@@ -903,7 +897,6 @@ static int hvcall_ipi_ex(const union hypercall_input *input,
     } input_params;
     union hypercall_vpset *vpset = &this_cpu(hypercall_vpset);
     struct hv_vpset *set = &vpset->set;
-    size_t size;
     int rc;
 
     /* These hypercalls should never use the fast-call convention. */
@@ -929,8 +922,7 @@ static int hvcall_ipi_ex(const union hypercall_input *input,
     {
         unsigned long offset = offsetof(typeof(input_params),
                                         set.bank_contents);
-
-        size = sizeof(*set->bank_contents) * hv_vpset_nr_banks(set);
+        size_t size = sizeof(*set->bank_contents) * hv_vpset_nr_banks(set);
 
         if ( offsetof(typeof(*vpset), set.bank_contents[0]) + size >
              sizeof(*vpset) )
@@ -943,11 +935,7 @@ static int hvcall_ipi_ex(const union hypercall_input *input,
                                       input_params_gpa + offset,
                                       size) != HVMTRANS_okay)
             return -EINVAL;
-
-        size += sizeof(*set);
     }
-    else
-        size = sizeof(*set);
 
     rc = hv_vpset_to_vpmask(set, vpmask);
     if ( rc )