* [PATCH v2] pinctrl: bcm2835: Replace BUG with WARN_ON
@ 2021-06-24 23:51 Jason Wang
2021-06-25 2:38 ` Florian Fainelli
2021-06-25 10:49 ` Stefan Wahren
0 siblings, 2 replies; 5+ messages in thread
From: Jason Wang @ 2021-06-24 23:51 UTC (permalink / raw)
To: =?gb18030?B?bGludXMud2FsbGVpag==?=
Cc: =?gb18030?B?bnNhZW56?=, =?gb18030?B?Zi5mYWluZWxsaQ==?=,
=?gb18030?B?cmp1aQ==?=, =?gb18030?B?c2JyYW5kZW4=?=,
=?gb18030?B?YmNtLWtlcm5lbC1mZWVkYmFjay1saXN0?=,
=?gb18030?B?cGhpbA==?=, =?gb18030?B?aWl2YW5vdg==?=,
=?gb18030?B?bGludXgtZ3Bpbw==?=,
=?gb18030?B?bGludXgtcnBpLWtlcm5lbA==?=,
=?gb18030?B?bGludXgtYXJtLWtlcm5lbA==?=,
=?gb18030?B?bGludXgta2VybmVs?=,
=?gb18030?B?hDGkN4QxpDeEMaQ3hDGkNw==?=
The if condition followed by BUG can be replaced to WARN_ON which is
more compact and formal in linux source.
Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
---
Changes in v2:
Accept Florian's advice to replace the BUG_ON() with a WARN_ON().
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();
+ WARN_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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] pinctrl: bcm2835: Replace BUG with WARN_ON
2021-06-24 23:51 [PATCH v2] pinctrl: bcm2835: Replace BUG with WARN_ON Jason Wang
@ 2021-06-25 2:38 ` Florian Fainelli
2021-06-25 10:49 ` Stefan Wahren
1 sibling, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2021-06-25 2:38 UTC (permalink / raw)
To: Jason Wang, linus.walleij
Cc: nsaenz, f.fainelli, rjui, sbranden, bcm-kernel-feedback-list,
phil, iivanov, linux-gpio, linux-rpi-kernel, linux-arm-kernel,
linux-kernel
On 6/24/2021 4:51 PM, Jason Wang wrote:
> The if condition followed by BUG can be replaced to WARN_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>
--
Florian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] pinctrl: bcm2835: Replace BUG with WARN_ON
@ 2021-06-25 2:38 ` Florian Fainelli
0 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2021-06-25 2:38 UTC (permalink / raw)
To: Jason Wang, linus.walleij
Cc: nsaenz, f.fainelli, rjui, sbranden, bcm-kernel-feedback-list,
phil, iivanov, linux-gpio, linux-rpi-kernel, linux-arm-kernel,
linux-kernel
On 6/24/2021 4:51 PM, Jason Wang wrote:
> The if condition followed by BUG can be replaced to WARN_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>
--
Florian
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] pinctrl: bcm2835: Replace BUG with WARN_ON
2021-06-24 23:51 [PATCH v2] pinctrl: bcm2835: Replace BUG with WARN_ON Jason Wang
@ 2021-06-25 10:49 ` Stefan Wahren
2021-06-25 10:49 ` Stefan Wahren
1 sibling, 0 replies; 5+ messages in thread
From: Stefan Wahren @ 2021-06-25 10:49 UTC (permalink / raw)
To: Jason Wang, linus.walleij
Cc: nsaenz, f.fainelli, rjui, sbranden, bcm-kernel-feedback-list,
phil, iivanov, linux-gpio, linux-rpi-kernel, linux-arm-kernel,
linux-kernel
Hi,
Am 25.06.21 um 01:51 schrieb Jason Wang:
> The if condition followed by BUG can be replaced to WARN_ON which is
> more compact and formal in linux source.
>
> Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
> ---
>
> Changes in v2:
> Accept Florian's advice to replace the BUG_ON() with a WARN_ON().
>
> 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();
> + WARN_ON(i == BCM2835_NUM_IRQS);
whenever this should happen, the source of this interrupt cannot be
determined and acked. So it's very likely that we end up in some kind of
interrupt storm. So i suggest to use at least WARN_ON_ONCE().
Even worse the value of variable "group" is uninitialized in this case,
so maybe we better return immediately after that.
Regards
>
> chained_irq_enter(host_chip, desc);
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] pinctrl: bcm2835: Replace BUG with WARN_ON
@ 2021-06-25 10:49 ` Stefan Wahren
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Wahren @ 2021-06-25 10:49 UTC (permalink / raw)
To: Jason Wang, linus.walleij
Cc: nsaenz, f.fainelli, rjui, sbranden, bcm-kernel-feedback-list,
phil, iivanov, linux-gpio, linux-rpi-kernel, linux-arm-kernel,
linux-kernel
Hi,
Am 25.06.21 um 01:51 schrieb Jason Wang:
> The if condition followed by BUG can be replaced to WARN_ON which is
> more compact and formal in linux source.
>
> Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
> ---
>
> Changes in v2:
> Accept Florian's advice to replace the BUG_ON() with a WARN_ON().
>
> 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();
> + WARN_ON(i == BCM2835_NUM_IRQS);
whenever this should happen, the source of this interrupt cannot be
determined and acked. So it's very likely that we end up in some kind of
interrupt storm. So i suggest to use at least WARN_ON_ONCE().
Even worse the value of variable "group" is uninitialized in this case,
so maybe we better return immediately after that.
Regards
>
> chained_irq_enter(host_chip, desc);
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-06-25 11:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 23:51 [PATCH v2] pinctrl: bcm2835: Replace BUG with WARN_ON Jason Wang
2021-06-25 2:38 ` Florian Fainelli
2021-06-25 2:38 ` Florian Fainelli
2021-06-25 10:49 ` Stefan Wahren
2021-06-25 10:49 ` Stefan Wahren
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.