diff mbox series

[2/3] x86/Viridian: drop dead variable updates

Message ID ae2fa743-da2b-91a8-908f-b0c7bb006fd0@suse.com (mailing list archive)
State New, archived
Headers show
Series x86/Viridian: ExProcessorMasks handling improvements | expand

Commit Message

Jan Beulich Nov. 18, 2021, 1:14 p.m. UTC
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>

Comments

Paul Durrant Nov. 18, 2021, 6:47 p.m. UTC | #1
On 18/11/2021 13:14, Jan Beulich wrote:
> 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>
diff mbox series

Patch

--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -776,7 +776,6 @@  static int hvcall_flush_ex(const union h
     {
         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 h
         {
             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 h
                                           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 hyp
     } 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 hyp
     {
         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 hyp
                                       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 )