# \[PATCH\] pinctrl: bcm2835: Replace BUG with BUG\_ON

- Subsystems: PIN CONTROL SUBSYSTEM, THE REST
- Maintainers: Linus Walleij, Linus Torvalds
- Status: LANDED (29d45a642d4e · 2021-07-23 15:47)
- Landed in mainline as 29d45a642d4e on 2021-07-23.
- List: linux-arm-kernel
- 3 messages, 3 authors
- Page: https://ratatoskr.run/linux-arm-kernel/2021/06/8808876/t

## \[PATCH\] pinctrl: bcm2835: Replace BUG with BUG\_ON

- From: Jason Wang \<hidden\>
- Date: 2021-06-24 06:52:19 
- Message: https://ratatoskr.run/linux-arm-kernel/2021/06/8808876.md

```text
The if condition followed by BUG can be replaced to BUG_ON which is
more compact and formal in linux source.

Signed-off-by: Jason Wang <redacted>
---
 drivers/pinctrl/bcm/pinctrl-bcm2835.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
index 2c87af1180c4..8440c722f6f8 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -416,8 +416,7 @@ static void bcm2835_gpio_irq_handler(struct irq_desc *desc)
 		}
 	}
 	/* This should not happen, every IRQ has a bank */
-	if (i == BCM2835_NUM_IRQS)
-		BUG();
+	BUG_ON(i == BCM2835_NUM_IRQS);
 
 	chained_irq_enter(host_chip, desc);
 
-- 
2.31.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```

## Re: \[PATCH\] pinctrl: bcm2835: Replace BUG with BUG\_ON

- From: Florian Fainelli \<f.fainelli@gmail.com\>
- Date: 2021-06-24 16:22:48 
- Message: https://ratatoskr.run/linux-arm-kernel/2021/06/1425098.md

```text
On 6/23/21 11:49 PM, Jason Wang wrote:
> The if condition followed by BUG can be replaced to BUG_ON which is
> more compact and formal in linux source.
> 
> Signed-off-by: Jason Wang <redacted>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>

Although I would rather completely remove this BUG_ON() and replace it
with a WARN_ON() instead, no need to kill the machine for such a
problem, however unlikely it is to appear.
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```

## Re: \[PATCH\] pinctrl: bcm2835: Replace BUG with BUG\_ON

- From: Linus Walleij \<hidden\>
- Date: 2021-07-23 15:47:38 
- Message: https://ratatoskr.run/linux-arm-kernel/2021/07/1456064.md

```text
On Thu, Jun 24, 2021 at 8:50 AM Jason Wang [ref] wrote:

> The if condition followed by BUG can be replaced to BUG_ON which is
> more compact and formal in linux source.
>
> Signed-off-by: Jason Wang <redacted>

Patch applied.

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```
