[XEN PATCH] x86/mce: change parameter names in function definitions to match the corresponding declarations

Federico Serafini posted 1 patch 9 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/5d1b292f3bb46dccf7e1cae38903165c5e236507.1689321884.git.federico.serafini@bugseng.com
xen/arch/x86/cpu/mcheck/mce.c     | 11 +++++------
xen/arch/x86/cpu/mcheck/mce_amd.c | 16 ++++++++--------
2 files changed, 13 insertions(+), 14 deletions(-)
[XEN PATCH] x86/mce: change parameter names in function definitions to match the corresponding declarations
Posted by Federico Serafini 9 months, 2 weeks ago
Change parameter names in function definitions to match the
corresponding delcarations thus fixing violations of MISRA C:2012
Rule 8.3 ("All declarations of an object or function shall use the same
names and type qualifiers").

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
 xen/arch/x86/cpu/mcheck/mce.c     | 11 +++++------
 xen/arch/x86/cpu/mcheck/mce_amd.c | 16 ++++++++--------
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 3e93bdd8da..140634198c 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -123,7 +123,7 @@ void mce_recoverable_register(mce_recoverable_t cbfunc)
     mc_recoverable_scan = cbfunc;
 }
 
-struct mca_banks *mcabanks_alloc(unsigned int nr_mce_banks)
+struct mca_banks *mcabanks_alloc(unsigned int nr)
 {
     struct mca_banks *mb;
 
@@ -135,18 +135,17 @@ struct mca_banks *mcabanks_alloc(unsigned int nr_mce_banks)
      * For APs allocations get done by the BSP, i.e. when the bank count may
      * may not be known yet. A zero bank count is a clear indication of this.
      */
-    if ( !nr_mce_banks )
-        nr_mce_banks = MCG_CAP_COUNT;
+    if ( !nr )
+        nr = MCG_CAP_COUNT;
 
-    mb->bank_map = xzalloc_array(unsigned long,
-                                 BITS_TO_LONGS(nr_mce_banks));
+    mb->bank_map = xzalloc_array(unsigned long, BITS_TO_LONGS(nr));
     if ( !mb->bank_map )
     {
         xfree(mb);
         return NULL;
     }
 
-    mb->num = nr_mce_banks;
+    mb->num = nr;
 
     return mb;
 }
diff --git a/xen/arch/x86/cpu/mcheck/mce_amd.c b/xen/arch/x86/cpu/mcheck/mce_amd.c
index 3c374fd4e4..6c7951d028 100644
--- a/xen/arch/x86/cpu/mcheck/mce_amd.c
+++ b/xen/arch/x86/cpu/mcheck/mce_amd.c
@@ -272,13 +272,13 @@ int vmce_amd_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
 }
 
 enum mcheck_type
-amd_mcheck_init(struct cpuinfo_x86 *ci)
+amd_mcheck_init(struct cpuinfo_x86 *c)
 {
     uint32_t i;
     enum mcequirk_amd_flags quirkflag = 0;
 
-    if ( ci->x86_vendor != X86_VENDOR_HYGON )
-        quirkflag = mcequirk_lookup_amd_quirkdata(ci);
+    if ( c->x86_vendor != X86_VENDOR_HYGON )
+        quirkflag = mcequirk_lookup_amd_quirkdata(c);
 
     /* Assume that machine check support is available.
      * The minimum provided support is at least the K8. */
@@ -298,14 +298,14 @@ amd_mcheck_init(struct cpuinfo_x86 *ci)
         }
     }
 
-    if ( ci->x86 == 0xf )
+    if ( c->x86 == 0xf )
         return mcheck_amd_k8;
 
     if ( quirkflag == MCEQUIRK_F10_GART )
         mcequirk_amd_apply(quirkflag);
 
-    if ( cpu_has(ci, X86_FEATURE_AMD_PPIN) &&
-         (ci == &boot_cpu_data || ppin_msr) )
+    if ( cpu_has(c, X86_FEATURE_AMD_PPIN) &&
+         (c == &boot_cpu_data || ppin_msr) )
     {
         uint64_t val;
 
@@ -320,7 +320,7 @@ amd_mcheck_init(struct cpuinfo_x86 *ci)
 
         if ( !(val & PPIN_ENABLE) )
             ppin_msr = 0;
-        else if ( ci == &boot_cpu_data )
+        else if ( c == &boot_cpu_data )
             ppin_msr = MSR_AMD_PPIN;
     }
 
@@ -328,6 +328,6 @@ amd_mcheck_init(struct cpuinfo_x86 *ci)
     mce_recoverable_register(mc_amd_recoverable_scan);
     mce_register_addrcheck(mc_amd_addrcheck);
 
-    return ci->x86_vendor == X86_VENDOR_HYGON ?
+    return c->x86_vendor == X86_VENDOR_HYGON ?
             mcheck_hygon : mcheck_amd_famXX;
 }
-- 
2.34.1
Re: [XEN PATCH] x86/mce: change parameter names in function definitions to match the corresponding declarations
Posted by Jan Beulich 9 months, 2 weeks ago
On 14.07.2023 10:10, Federico Serafini wrote:
> Change parameter names in function definitions to match the
> corresponding delcarations thus fixing violations of MISRA C:2012
> Rule 8.3 ("All declarations of an object or function shall use the same
> names and type qualifiers").
> 
> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>

Acked-by: Jan Beulich <jbeulich@suse.com>

Would have been nice if ...

> --- a/xen/arch/x86/cpu/mcheck/mce_amd.c
> +++ b/xen/arch/x86/cpu/mcheck/mce_amd.c
> @@ -272,13 +272,13 @@ int vmce_amd_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
>  }
>  
>  enum mcheck_type
> -amd_mcheck_init(struct cpuinfo_x86 *ci)
> +amd_mcheck_init(struct cpuinfo_x86 *c)

... const had been added here on this occasion; I may take the liberty
of doing so while committing.

Jan