diff mbox series

[XEN,1/3] xen/arm: platform: address violation of MISRA C Rule 7.2

Message ID 33f3ba81af293a92fb27d55b42e620b807f1a5b3.1739564781.git.nicola.vetrini@bugseng.com (mailing list archive)
State New
Headers show
Series Move Xen ECLAIR configuration to analyze.yaml | expand

Commit Message

Nicola Vetrini Feb. 14, 2025, 8:45 p.m. UTC
Rule 7.2 states: "A u or U suffix shall be applied to all integer
constants that are represented in an unsigned type".

Some PM_* constants are unsigned quantities, despite some
of them being representable in a signed type, so a 'U' suffix
should be present.

No functional change.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
---
This fix is needed in order to keep the rule clean when the
Xen configuration under static analysis is changed later in patch 3
of this series.

Only PM_RSTC_WRCFG_CLR is strictly needed to conform to the rule,
but the other constants have a 'U' added for consistency. PM_RSTC
and PM_WDOG are used as offsets, so in principle they can be negative,
therefore they are left as is.
---
 xen/arch/arm/platforms/brcm-raspberry-pi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Stefano Stabellini Feb. 14, 2025, 11:04 p.m. UTC | #1
On Fri, 14 Feb 2025, Nicola Vetrini wrote:
> Rule 7.2 states: "A u or U suffix shall be applied to all integer
> constants that are represented in an unsigned type".
> 
> Some PM_* constants are unsigned quantities, despite some
> of them being representable in a signed type, so a 'U' suffix
> should be present.
> 
> No functional change.
> 
> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> This fix is needed in order to keep the rule clean when the
> Xen configuration under static analysis is changed later in patch 3
> of this series.
> 
> Only PM_RSTC_WRCFG_CLR is strictly needed to conform to the rule,
> but the other constants have a 'U' added for consistency. PM_RSTC
> and PM_WDOG are used as offsets, so in principle they can be negative,
> therefore they are left as is.
> ---
>  xen/arch/arm/platforms/brcm-raspberry-pi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/arch/arm/platforms/brcm-raspberry-pi.c b/xen/arch/arm/platforms/brcm-raspberry-pi.c
> index 407ec07f63b8..d49460329cc8 100644
> --- a/xen/arch/arm/platforms/brcm-raspberry-pi.c
> +++ b/xen/arch/arm/platforms/brcm-raspberry-pi.c
> @@ -47,11 +47,11 @@ static const struct dt_device_match rpi4_blacklist_dev[] __initconst =
>  };
>  
>  
> -#define PM_PASSWORD                 0x5a000000
> +#define PM_PASSWORD                 0x5a000000U
>  #define PM_RSTC                     0x1c
>  #define PM_WDOG                     0x24
> -#define PM_RSTC_WRCFG_FULL_RESET    0x00000020
> -#define PM_RSTC_WRCFG_CLR           0xffffffcf
> +#define PM_RSTC_WRCFG_FULL_RESET    0x00000020U
> +#define PM_RSTC_WRCFG_CLR           0xffffffcfU
>  
>  static void __iomem *rpi4_map_watchdog(void)
>  {
> -- 
> 2.43.0
>
diff mbox series

Patch

diff --git a/xen/arch/arm/platforms/brcm-raspberry-pi.c b/xen/arch/arm/platforms/brcm-raspberry-pi.c
index 407ec07f63b8..d49460329cc8 100644
--- a/xen/arch/arm/platforms/brcm-raspberry-pi.c
+++ b/xen/arch/arm/platforms/brcm-raspberry-pi.c
@@ -47,11 +47,11 @@  static const struct dt_device_match rpi4_blacklist_dev[] __initconst =
 };
 
 
-#define PM_PASSWORD                 0x5a000000
+#define PM_PASSWORD                 0x5a000000U
 #define PM_RSTC                     0x1c
 #define PM_WDOG                     0x24
-#define PM_RSTC_WRCFG_FULL_RESET    0x00000020
-#define PM_RSTC_WRCFG_CLR           0xffffffcf
+#define PM_RSTC_WRCFG_FULL_RESET    0x00000020U
+#define PM_RSTC_WRCFG_CLR           0xffffffcfU
 
 static void __iomem *rpi4_map_watchdog(void)
 {