linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Oliver O'Halloran <oohall@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Oliver O'Halloran <oohall@gmail.com>
Subject: [PATCH 1/6] powerpc/powernv/smp: Fix spurious DBG() warning
Date: Tue,  4 Aug 2020 10:54:05 +1000	[thread overview]
Message-ID: <20200804005410.146094-2-oohall@gmail.com> (raw)
In-Reply-To: <20200804005410.146094-1-oohall@gmail.com>

When building with W=1 we get the following warning:

 arch/powerpc/platforms/powernv/smp.c: In function ‘pnv_smp_cpu_kill_self’:
 arch/powerpc/platforms/powernv/smp.c:276:16: error: suggest braces around
 	empty body in an ‘if’ statement [-Werror=empty-body]
   276 |      cpu, srr1);
       |                ^
 cc1: all warnings being treated as errors

The full context is this block:

 if (srr1 && !generic_check_cpu_restart(cpu))
 	DBG("CPU%d Unexpected exit while offline srr1=%lx!\n",
 			cpu, srr1);

When building with DEBUG undefined DBG() expands to nothing and GCC emits
the warning due to the lack of braces around an empty statement.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
We could add the braces too. That might even be better since it's a multi-line
if block even though it's only a single statement.
---
 arch/powerpc/platforms/powernv/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
index b2ba3e95bda7..bbf361f23ae8 100644
--- a/arch/powerpc/platforms/powernv/smp.c
+++ b/arch/powerpc/platforms/powernv/smp.c
@@ -43,7 +43,7 @@
 #include <asm/udbg.h>
 #define DBG(fmt...) udbg_printf(fmt)
 #else
-#define DBG(fmt...)
+#define DBG(fmt...) do { } while (0)
 #endif
 
 static void pnv_smp_setup_cpu(int cpu)
-- 
2.26.2


  reply	other threads:[~2020-08-04  0:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04  0:54 Clean up W=1 for the powernv platform Oliver O'Halloran
2020-08-04  0:54 ` Oliver O'Halloran [this message]
2020-08-04  2:07   ` [PATCH 1/6] powerpc/powernv/smp: Fix spurious DBG() warning Joel Stanley
2020-08-04  6:58     ` Oliver O'Halloran
2020-08-04 12:05     ` Michael Ellerman
2020-09-09 13:37   ` Michael Ellerman
2020-08-04  0:54 ` [PATCH 2/6] powerpc/powernv: Include asm/powernv.h from the local powernv.h Oliver O'Halloran
2020-08-04  0:54 ` [PATCH 3/6] powerpc/powernv: Staticify functions without prototypes Oliver O'Halloran
2020-08-04  2:17   ` Joel Stanley
2020-08-04  0:54 ` [PATCH 4/6] powerpc/powernv: Fix spurious kerneldoc warnings in opal-prd.c Oliver O'Halloran
2020-08-04  2:18   ` Joel Stanley
2020-08-04  0:54 ` [PATCH 5/6] powerpc/powernv/pci: Drop unused parent variable Oliver O'Halloran
2020-08-04  2:19   ` Joel Stanley
2020-08-04  0:54 ` [PATCH 6/6] powerpc/nx: Don't pack struct coprocessor_request_block Oliver O'Halloran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200804005410.146094-2-oohall@gmail.com \
    --to=oohall@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).