diff mbox series

pinctrl: bcm2835: Replace BUG with BUG_ON

Message ID 20210624064913.41788-1-wangborong@cdjrlc.com (mailing list archive)
State New, archived
Headers show
Series pinctrl: bcm2835: Replace BUG with BUG_ON | expand

Commit Message

Jason Wang June 24, 2021, 6:49 a.m. UTC
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 <wangborong@cdjrlc.com>
---
 drivers/pinctrl/bcm/pinctrl-bcm2835.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Florian Fainelli June 24, 2021, 4:22 p.m. UTC | #1
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 <wangborong@cdjrlc.com>

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.
Linus Walleij July 23, 2021, 3:47 p.m. UTC | #2
On Thu, Jun 24, 2021 at 8:50 AM Jason Wang <wangborong@cdjrlc.com> 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 <wangborong@cdjrlc.com>

Patch applied.

Yours,
Linus Walleij
diff mbox series

Patch

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