Re: [PATCH 3/3] xen/x86: Address two misc MISRA 17.7 violations

2024-05-21 Thread Stefano Stabellini
On Tue, 21 May 2024, Andrew Cooper wrote:
> Neither text_poke() nor watchdog_setup() have return value consulted.  Switch
> them to being void.
> 
> Signed-off-by: Andrew Cooper 

Reviewed-by: Stefano Stabellini 


> ---
> CC: George Dunlap 
> CC: Jan Beulich 
> CC: Stefano Stabellini 
> CC: Julien Grall 
> CC: Roberto Bagnara 
> CC: consult...@bugseng.com 
> CC: Oleksii Kurochko 
> ---
>  xen/arch/x86/alternative.c | 4 ++--
>  xen/arch/x86/nmi.c | 5 ++---
>  xen/include/xen/watchdog.h | 2 +-
>  3 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
> index 2e7ba6e0b833..7824053c9d33 100644
> --- a/xen/arch/x86/alternative.c
> +++ b/xen/arch/x86/alternative.c
> @@ -155,10 +155,10 @@ void init_or_livepatch add_nops(void *insns, unsigned 
> int len)
>   * "noinline" to cause control flow change and thus invalidate I$ and
>   * cause refetch after modification.
>   */
> -static void *init_or_livepatch noinline
> +static void init_or_livepatch noinline
>  text_poke(void *addr, const void *opcode, size_t len)
>  {
> -return memcpy(addr, opcode, len);
> +memcpy(addr, opcode, len);
>  }
>  
>  extern void *const __initdata_cf_clobber_start[];
> diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c
> index f6329cb0270e..9793fa23168d 100644
> --- a/xen/arch/x86/nmi.c
> +++ b/xen/arch/x86/nmi.c
> @@ -464,12 +464,12 @@ bool watchdog_enabled(void)
>  return !atomic_read(&watchdog_disable_count);
>  }
>  
> -int __init watchdog_setup(void)
> +void __init watchdog_setup(void)
>  {
>  unsigned int cpu;
>  
>  /*
> - * Activate periodic heartbeats. We cannot do this earlier during 
> + * Activate periodic heartbeats. We cannot do this earlier during
>   * setup because the timer infrastructure is not available.
>   */
>  for_each_online_cpu ( cpu )
> @@ -477,7 +477,6 @@ int __init watchdog_setup(void)
>  register_cpu_notifier(&cpu_nmi_nfb);
>  
>  watchdog_enable();
> -return 0;
>  }
>  
>  /* Returns false if this was not a watchdog NMI, true otherwise */
> diff --git a/xen/include/xen/watchdog.h b/xen/include/xen/watchdog.h
> index 434fcbdd2b11..40c21bca823f 100644
> --- a/xen/include/xen/watchdog.h
> +++ b/xen/include/xen/watchdog.h
> @@ -10,7 +10,7 @@
>  #include 
>  
>  /* Try to set up a watchdog. */
> -int watchdog_setup(void);
> +void watchdog_setup(void);
>  
>  /* Enable the watchdog. */
>  void watchdog_enable(void);
> -- 
> 2.30.2
> 



[PATCH 3/3] xen/x86: Address two misc MISRA 17.7 violations

2024-05-21 Thread Andrew Cooper
Neither text_poke() nor watchdog_setup() have return value consulted.  Switch
them to being void.

Signed-off-by: Andrew Cooper 
---
CC: George Dunlap 
CC: Jan Beulich 
CC: Stefano Stabellini 
CC: Julien Grall 
CC: Roberto Bagnara 
CC: consult...@bugseng.com 
CC: Oleksii Kurochko 
---
 xen/arch/x86/alternative.c | 4 ++--
 xen/arch/x86/nmi.c | 5 ++---
 xen/include/xen/watchdog.h | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
index 2e7ba6e0b833..7824053c9d33 100644
--- a/xen/arch/x86/alternative.c
+++ b/xen/arch/x86/alternative.c
@@ -155,10 +155,10 @@ void init_or_livepatch add_nops(void *insns, unsigned int 
len)
  * "noinline" to cause control flow change and thus invalidate I$ and
  * cause refetch after modification.
  */
-static void *init_or_livepatch noinline
+static void init_or_livepatch noinline
 text_poke(void *addr, const void *opcode, size_t len)
 {
-return memcpy(addr, opcode, len);
+memcpy(addr, opcode, len);
 }
 
 extern void *const __initdata_cf_clobber_start[];
diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c
index f6329cb0270e..9793fa23168d 100644
--- a/xen/arch/x86/nmi.c
+++ b/xen/arch/x86/nmi.c
@@ -464,12 +464,12 @@ bool watchdog_enabled(void)
 return !atomic_read(&watchdog_disable_count);
 }
 
-int __init watchdog_setup(void)
+void __init watchdog_setup(void)
 {
 unsigned int cpu;
 
 /*
- * Activate periodic heartbeats. We cannot do this earlier during 
+ * Activate periodic heartbeats. We cannot do this earlier during
  * setup because the timer infrastructure is not available.
  */
 for_each_online_cpu ( cpu )
@@ -477,7 +477,6 @@ int __init watchdog_setup(void)
 register_cpu_notifier(&cpu_nmi_nfb);
 
 watchdog_enable();
-return 0;
 }
 
 /* Returns false if this was not a watchdog NMI, true otherwise */
diff --git a/xen/include/xen/watchdog.h b/xen/include/xen/watchdog.h
index 434fcbdd2b11..40c21bca823f 100644
--- a/xen/include/xen/watchdog.h
+++ b/xen/include/xen/watchdog.h
@@ -10,7 +10,7 @@
 #include 
 
 /* Try to set up a watchdog. */
-int watchdog_setup(void);
+void watchdog_setup(void);
 
 /* Enable the watchdog. */
 void watchdog_enable(void);
-- 
2.30.2