diff mbox series

gpio: aspeed: avoid return type warning

Message ID 20191210202842.2546758-1-arnd@arndb.de
State Accepted
Commit 11e299de3aced4ea23a9fb1fef6c983c8d516302
Headers show
Series gpio: aspeed: avoid return type warning | expand

Commit Message

Arnd Bergmann Dec. 10, 2019, 8:28 p.m. UTC
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 <arnd@arndb.de>

---
 drivers/gpio/gpio-aspeed-sgpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.20.0

Comments

Andrew Jeffery Dec. 10, 2019, 10:12 p.m. UTC | #1
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 <arnd@arndb.de>


Acked-by: Andrew Jeffery <andrew@aj.id.au>
Bartosz Golaszewski Dec. 11, 2019, 9:07 a.m. UTC | #2
wt., 10 gru 2019 o 23:10 Andrew Jeffery <andrew@aj.id.au> 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 <arnd@arndb.de>

>

> Acked-by: Andrew Jeffery <andrew@aj.id.au>


Applied for fixes.

Bartosz
diff mbox series

Patch

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();
 	}
 }