[PATCH] bug: Fix no-return-statement warning with !CONFIG_BUG

Naresh Kamboju naresh.kamboju at linaro.org
Thu Apr 11 03:02:16 AEST 2024


On Wed, 10 Apr 2024 at 21:02, Adrian Hunter <adrian.hunter at intel.com> wrote:
>
> 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 at linaro.org>
> Closes: https://lore.kernel.org/all/CA+G9fYvjdZCW=7ZGxS6A_3bysjQ56YF7S-+PNLQ_8a4DKh1Bhg@mail.gmail.com/
> Signed-off-by: Adrian Hunter <adrian.hunter at intel.com>

This patch applied on top of today's Linux next-20240410 tag and
build test pass.

Tested-by: Linux Kernel Functional Testing <lkft at linaro.org>

> ---
>  include/asm-generic/bug.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

--
Linaro LKFT
https://lkft.linaro.org


More information about the Linuxppc-dev mailing list