2019-12-10 20:31:14

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH] gpio: aspeed: avoid return type warning

gcc has a hard time tracking whether BUG_ON(1) ends
execution or not:

drivers/gpio/gpio-aspeed-sgpio.c: In function 'bank_reg':
drivers/gpio/gpio-aspeed-sgpio.c:112:1: error: control reaches end of non-void function [-Werror=return-type]

Use the simpler BUG() that gcc knows cannot continue.

Fixes: f8b410e3695a ("gpio: aspeed-sgpio: Rename and add Kconfig/Makefile")
Signed-off-by: Arnd Bergmann <[email protected]>
---
drivers/gpio/gpio-aspeed-sgpio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-aspeed-sgpio.c b/drivers/gpio/gpio-aspeed-sgpio.c
index 7e99860ca447..8319812593e3 100644
--- a/drivers/gpio/gpio-aspeed-sgpio.c
+++ b/drivers/gpio/gpio-aspeed-sgpio.c
@@ -107,7 +107,7 @@ static void __iomem *bank_reg(struct aspeed_sgpio *gpio,
return gpio->base + bank->irq_regs + GPIO_IRQ_STATUS;
default:
/* acturally if code runs to here, it's an error case */
- BUG_ON(1);
+ BUG();
}
}

--
2.20.0


2019-12-10 22:12:02

by Andrew Jeffery

[permalink] [raw]
Subject: Re: [PATCH] gpio: aspeed: avoid return type warning



On Wed, 11 Dec 2019, at 06:58, Arnd Bergmann wrote:
> gcc has a hard time tracking whether BUG_ON(1) ends
> execution or not:
>
> drivers/gpio/gpio-aspeed-sgpio.c: In function 'bank_reg':
> drivers/gpio/gpio-aspeed-sgpio.c:112:1: error: control reaches end of
> non-void function [-Werror=return-type]
>
> Use the simpler BUG() that gcc knows cannot continue.
>
> Fixes: f8b410e3695a ("gpio: aspeed-sgpio: Rename and add Kconfig/Makefile")
> Signed-off-by: Arnd Bergmann <[email protected]>

Acked-by: Andrew Jeffery <[email protected]>

2019-12-11 09:08:39

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH] gpio: aspeed: avoid return type warning

wt., 10 gru 2019 o 23:10 Andrew Jeffery <[email protected]> napisaƂ(a):
>
>
>
> On Wed, 11 Dec 2019, at 06:58, Arnd Bergmann wrote:
> > gcc has a hard time tracking whether BUG_ON(1) ends
> > execution or not:
> >
> > drivers/gpio/gpio-aspeed-sgpio.c: In function 'bank_reg':
> > drivers/gpio/gpio-aspeed-sgpio.c:112:1: error: control reaches end of
> > non-void function [-Werror=return-type]
> >
> > Use the simpler BUG() that gcc knows cannot continue.
> >
> > Fixes: f8b410e3695a ("gpio: aspeed-sgpio: Rename and add Kconfig/Makefile")
> > Signed-off-by: Arnd Bergmann <[email protected]>
>
> Acked-by: Andrew Jeffery <[email protected]>

Applied for fixes.

Bartosz