Message ID | 4a07e7bb893f3d96e007ef6ccb645eee0d730489.1691575243.git.nicola.vetrini@bugseng.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | xen: address MISRA C:2012 Rule 8.4 | expand |
On 09.08.2023 13:02, Nicola Vetrini wrote: > The functions and variables touched by this commit can be static, > as they are only used within the same unit. This in turn addresses > the absence of declarations that violates Rule 8.4. > > Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com> I'm happy with the code changes here and also in patch 3, but please make the titles meaningful (in patch 3 the prefix also wants to be more specific). As mentioned, the Misra rule is secondary here, and hence doesn't need to be present in the titles. Jan
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c index 57e1eb221e..6141b7eb9c 100644 --- a/xen/arch/x86/cpu/mcheck/mce.c +++ b/xen/arch/x86/cpu/mcheck/mce.c @@ -599,7 +599,7 @@ unsigned int mce_firstbank(struct cpuinfo_x86 *c) c->x86_vendor == X86_VENDOR_INTEL && c->x86_model < 0x1a; } -int show_mca_info(int inited, struct cpuinfo_x86 *c) +static int show_mca_info(int inited, struct cpuinfo_x86 *c) { static enum mcheck_type g_type = mcheck_unset; diff --git a/xen/arch/x86/cpu/mcheck/mce_amd.c b/xen/arch/x86/cpu/mcheck/mce_amd.c index adc36522cc..72f3feeaee 100644 --- a/xen/arch/x86/cpu/mcheck/mce_amd.c +++ b/xen/arch/x86/cpu/mcheck/mce_amd.c @@ -87,7 +87,7 @@ enum mc_ec_type { MC_EC_BUS_TYPE = 0x0800, }; -enum mc_ec_type +static enum mc_ec_type mc_ec2type(uint16_t errorcode) { if ( errorcode & MC_EC_BUS_TYPE ) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c index bec8b55db2..9fcb9c1c3a 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -149,7 +149,7 @@ static int __init cf_check parse_ucode(const char *s) } custom_param("ucode", parse_ucode); -void __init microcode_scan_module( +static void __init microcode_scan_module( unsigned long *module_map, const multiboot_info_t *mbi) { diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c index c5c28300b0..104e366bd3 100644 --- a/xen/arch/x86/nmi.c +++ b/xen/arch/x86/nmi.c @@ -108,7 +108,7 @@ static unsigned int lapic_nmi_owner; * be enabled * -1: the lapic NMI watchdog is disabled, but can be enabled */ -int nmi_active; +static int nmi_active; #define K7_EVNTSEL_ENABLE (1 << 22) #define K7_EVNTSEL_INT (1 << 20) diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c index ebe56a96cd..9b8fdb5303 100644 --- a/xen/arch/x86/spec_ctrl.c +++ b/xen/arch/x86/spec_ctrl.c @@ -43,9 +43,9 @@ static enum ind_thunk { } opt_thunk __initdata = THUNK_DEFAULT; static int8_t __initdata opt_ibrs = -1; -int8_t __initdata opt_stibp = -1; +static int8_t __initdata opt_stibp = -1; bool __ro_after_init opt_ssbd; -int8_t __initdata opt_psfd = -1; +static int8_t __initdata opt_psfd = -1; int8_t __ro_after_init opt_ibpb_ctxt_switch = -1; int8_t __read_mostly opt_eager_fpu = -1;
The functions and variables touched by this commit can be static, as they are only used within the same unit. This in turn addresses the absence of declarations that violates Rule 8.4. Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com> --- xen/arch/x86/cpu/mcheck/mce.c | 2 +- xen/arch/x86/cpu/mcheck/mce_amd.c | 2 +- xen/arch/x86/cpu/microcode/core.c | 2 +- xen/arch/x86/nmi.c | 2 +- xen/arch/x86/spec_ctrl.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-)