All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Adrian Hunter" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Naresh Kamboju <naresh.kamboju@linaro.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Linux Kernel Functional Testing <lkft@linaro.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: timers/urgent] bug: Fix no-return-statement warning with !CONFIG_BUG
Date: Wed, 10 Apr 2024 20:05:48 -0000	[thread overview]
Message-ID: <171277954823.10875.13569747246376964639.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20240410153212.127477-1-adrian.hunter@intel.com>

The following commit has been merged into the timers/urgent branch of tip:

Commit-ID:     5284984a4fbacb0883bfebe905902cdda2891a07
Gitweb:        https://git.kernel.org/tip/5284984a4fbacb0883bfebe905902cdda2891a07
Author:        Adrian Hunter <adrian.hunter@intel.com>
AuthorDate:    Wed, 10 Apr 2024 18:32:12 +03:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 10 Apr 2024 22:01:35 +02:00

bug: Fix no-return-statement warning with !CONFIG_BUG

BUG() does not return, and arch implementations of BUG() use unreachable()
or other non-returning code. However with !CONFIG_BUG, the default
implementation is often used instead, and that does not do that. x86 always
uses its own implementation, but powerpc with !CONFIG_BUG gives a build
error:

  kernel/time/timekeeping.c: In function ‘timekeeping_debug_get_ns’:
  kernel/time/timekeeping.c:286:1: error: no return statement in function
  returning non-void [-Werror=return-type]

Add unreachable() to default !CONFIG_BUG BUG() implementation.

Fixes: e8e9d21a5df6 ("timekeeping: Refactor timekeeping helpers")
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Link: https://lore.kernel.org/r/20240410153212.127477-1-adrian.hunter@intel.com
Closes: https://lore.kernel.org/all/CA+G9fYvjdZCW=7ZGxS6A_3bysjQ56YF7S-+PNLQ_8a4DKh1Bhg@mail.gmail.com/
---
 include/asm-generic/bug.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 6e79442..b7de3a4 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -156,7 +156,10 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
 
 #else /* !CONFIG_BUG */
 #ifndef HAVE_ARCH_BUG
-#define BUG() do {} while (1)
+#define BUG() do {		\
+	do {} while (1);	\
+	unreachable();		\
+} while (0)
 #endif
 
 #ifndef HAVE_ARCH_BUG_ON

  parent reply	other threads:[~2024-04-10 20:05 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-10 15:32 [PATCH] bug: Fix no-return-statement warning with !CONFIG_BUG Adrian Hunter
2024-04-10 15:32 ` Adrian Hunter
2024-04-10 17:02 ` Naresh Kamboju
2024-04-10 17:02   ` Naresh Kamboju
2024-04-10 20:05 ` tip-bot2 for Adrian Hunter [this message]
2024-04-11  7:04 ` Arnd Bergmann
2024-04-11  7:04   ` Arnd Bergmann
2024-04-11  7:16   ` Adrian Hunter
2024-04-11  7:16     ` Adrian Hunter
2024-04-11  7:56     ` Arnd Bergmann
2024-04-11  9:03       ` Adrian Hunter
2024-04-11 10:27         ` David Laight
2024-04-11  8:13     ` Christophe Leroy
2024-04-11  8:13       ` Christophe Leroy
2024-04-11  8:22       ` Christophe Leroy
2024-04-11  8:22         ` Christophe Leroy
2024-04-11  9:27         ` Adrian Hunter
2024-04-11  9:27           ` Adrian Hunter
2024-04-11 11:26           ` Arnd Bergmann
2024-04-11 11:26             ` Arnd Bergmann
2024-04-15  2:19             ` Michael Ellerman
2024-04-15 15:35               ` Arnd Bergmann
2024-04-15 15:35                 ` Arnd Bergmann
2024-04-15 17:07                 ` Christophe Leroy
2024-04-15 17:32                   ` Arnd Bergmann
2024-04-15 17:32                     ` Arnd Bergmann

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=171277954823.10875.13569747246376964639.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=adrian.hunter@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=lkft@linaro.org \
    --cc=naresh.kamboju@linaro.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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 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.