lkml.org 
[lkml]   [2022]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH] powerpc/interrupt: Put braces around empty body in an 'if' statement
Date


Le 19/06/2022 à 05:11, Souptick Joarder a écrit :
> From: "Souptick Joarder (HPE)" <jrdr.linux@gmail.com>
>
> Kernel test robot throws warning ->
>
> arch/powerpc/kernel/interrupt.c:
> In function 'interrupt_exit_kernel_prepare':
>
>>> arch/powerpc/kernel/interrupt.c:542:55: warning: suggest
> braces around empty body in an 'if' statement [-Wempty-body]
> 542 | CT_WARN_ON(ct_state() == CONTEXT_USER);
>
> Fix it by adding braces.

There must be no braces for single 'if' statement , see
https://docs.kernel.org/process/coding-style.html#placing-braces-and-spaces

The problem is likely that CT_WARN_ON() is empty in some CONFIGs.
You have to fix it, for instance by changing it to a "do { } while (0)"

>
> Reported-by: Kernel test robot <lkp@intel.com>
> Signed-off-by: Souptick Joarder (HPE) <jrdr.linux@gmail.com>
> ---
> arch/powerpc/kernel/interrupt.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c
> index 784ea3289c84..b8a918bab48f 100644
> --- a/arch/powerpc/kernel/interrupt.c
> +++ b/arch/powerpc/kernel/interrupt.c
> @@ -538,8 +538,9 @@ notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs)
> * CT_WARN_ON comes here via program_check_exception,
> * so avoid recursion.
> */
> - if (TRAP(regs) != INTERRUPT_PROGRAM)
> + if (TRAP(regs) != INTERRUPT_PROGRAM) {
> CT_WARN_ON(ct_state() == CONTEXT_USER);
> + }
>
> kuap = kuap_get_and_assert_locked();
>
> --
> 2.25.1
>
\
 
 \ /
  Last update: 2022-06-19 08:42    [W:0.040 / U:0.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site