All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: Robert Richter <rric@kernel.org>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Huacai Chen <chenhc@lemote.com>,
	Liangliang Huang <huanglllzu@gmail.com>
Cc: oprofile-list@lists.sf.net, linux-mips@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>
Subject: [PATCH] MIPS: op_model_mipsxx: Fix non-executable code bug
Date: Tue, 18 Aug 2020 23:58:13 -0500	[thread overview]
Message-ID: <20200819045813.GA24181@embeddedor> (raw)

The fallthrough pseudo-keyword is being wrongly used and is causing
the non-executable code error below:

arch/mips/oprofile/op_model_mipsxx.c: In function ‘mipsxx_perfcount_handler’:
./include/linux/compiler_attributes.h:214:41: warning: statement will never be executed [-Wswitch-unreachable]
 # define fallthrough                    __attribute__((__fallthrough__))
                                         ^
arch/mips/oprofile/op_model_mipsxx.c:248:2: note: in expansion of macro ‘fallthrough’
  fallthrough;       \
  ^~~~~~~~~~~
arch/mips/oprofile/op_model_mipsxx.c:258:2: note: in expansion of macro ‘HANDLE_COUNTER’
  HANDLE_COUNTER(3)
  ^~~~~~~~~~~~~~

Fix this by placing the fallthrough macro at the proper place.

Fixes: c9b029903466 ("MIPS: Use fallthrough for arch/mips")
Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 arch/mips/oprofile/op_model_mipsxx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c
index 1493c49ca47a..f200b97bdef7 100644
--- a/arch/mips/oprofile/op_model_mipsxx.c
+++ b/arch/mips/oprofile/op_model_mipsxx.c
@@ -245,7 +245,6 @@ static int mipsxx_perfcount_handler(void)
 
 	switch (counters) {
 #define HANDLE_COUNTER(n)						\
-	fallthrough;							\
 	case n + 1:							\
 		control = r_c0_perfctrl ## n();				\
 		counter = r_c0_perfcntr ## n();				\
@@ -254,7 +253,8 @@ static int mipsxx_perfcount_handler(void)
 			oprofile_add_sample(get_irq_regs(), n);		\
 			w_c0_perfcntr ## n(reg.counter[n]);		\
 			handled = IRQ_HANDLED;				\
-		}
+		}							\
+	fallthrough;
 	HANDLE_COUNTER(3)
 	HANDLE_COUNTER(2)
 	HANDLE_COUNTER(1)
-- 
2.27.0


             reply	other threads:[~2020-08-19  4:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-19  4:58 Gustavo A. R. Silva [this message]
2020-08-21  7:46 ` [PATCH] MIPS: op_model_mipsxx: Fix non-executable code bug Thomas Bogendoerfer

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=20200819045813.GA24181@embeddedor \
    --to=gustavoars@kernel.org \
    --cc=chenhc@lemote.com \
    --cc=huanglllzu@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=oprofile-list@lists.sf.net \
    --cc=rric@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.