[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v2 01/13] x86/cpufreq: fix violations of MISRA C:2012 Rule 7.2



On Wed, 5 Jul 2023, Simone Ballarin wrote:
> From: Gianluca Luparini <gianluca.luparini@xxxxxxxxxxx>
> 
> The xen sources contains violations of MISRA C:2012 Rule 7.2 whose
> headline states:
> "A 'u' or 'U' suffix shall be applied to all integer constants
> that are represented in an unsigned type".
> 
> Add the 'U' suffix to integers literals with unsigned type and also to other
> literals used in the same contexts or near violations, when their positive
> nature is immediately clear. The latter changes are done for the sake of
> uniformity.
> 
> Signed-off-by: Simone Ballarin <simone.ballarin@xxxxxxxxxxx>
> Signed-off-by: Gianluca Luparini <gianluca.luparini@xxxxxxxxxxx>

Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>


> ---
> Changes in v2:
> - change commit title to make it unique
> - change commit message
> ---
>  xen/arch/x86/acpi/cpufreq/powernow.c      | 14 +++++++-------
>  xen/include/acpi/cpufreq/processor_perf.h |  2 +-
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/xen/arch/x86/acpi/cpufreq/powernow.c 
> b/xen/arch/x86/acpi/cpufreq/powernow.c
> index d4c7dcd5d9..8e0784b69c 100644
> --- a/xen/arch/x86/acpi/cpufreq/powernow.c
> +++ b/xen/arch/x86/acpi/cpufreq/powernow.c
> @@ -32,14 +32,14 @@
>  #include <acpi/acpi.h>
>  #include <acpi/cpufreq/cpufreq.h>
>  
> -#define HW_PSTATE_MASK          0x00000007
> -#define HW_PSTATE_VALID_MASK    0x80000000
> -#define HW_PSTATE_MAX_MASK      0x000000f0
> +#define HW_PSTATE_MASK          0x00000007U
> +#define HW_PSTATE_VALID_MASK    0x80000000U
> +#define HW_PSTATE_MAX_MASK      0x000000f0U
>  #define HW_PSTATE_MAX_SHIFT     4
> -#define MSR_PSTATE_DEF_BASE     0xc0010064 /* base of Pstate MSRs */
> -#define MSR_PSTATE_STATUS       0xc0010063 /* Pstate Status MSR */
> -#define MSR_PSTATE_CTRL         0xc0010062 /* Pstate control MSR */
> -#define MSR_PSTATE_CUR_LIMIT    0xc0010061 /* pstate current limit MSR */
> +#define MSR_PSTATE_DEF_BASE     0xc0010064U /* base of Pstate MSRs */
> +#define MSR_PSTATE_STATUS       0xc0010063U /* Pstate Status MSR */
> +#define MSR_PSTATE_CTRL         0xc0010062U /* Pstate control MSR */
> +#define MSR_PSTATE_CUR_LIMIT    0xc0010061U /* pstate current limit MSR */
>  #define MSR_HWCR_CPBDIS_MASK    0x02000000ULL
>  
>  #define ARCH_CPU_FLAG_RESUME 1
> diff --git a/xen/include/acpi/cpufreq/processor_perf.h 
> b/xen/include/acpi/cpufreq/processor_perf.h
> index d8a1ba68a6..8b5a1b9bde 100644
> --- a/xen/include/acpi/cpufreq/processor_perf.h
> +++ b/xen/include/acpi/cpufreq/processor_perf.h
> @@ -5,7 +5,7 @@
>  #include <public/sysctl.h>
>  #include <xen/acpi.h>
>  
> -#define XEN_PX_INIT 0x80000000
> +#define XEN_PX_INIT 0x80000000U
>  
>  int powernow_cpufreq_init(void);
>  unsigned int powernow_register_driver(void);
> -- 
> 2.41.0
> 



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.