LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH linux-next] net: bonding: bond_alb: Replace if (cond) BUG() with BUG_ON()
@ 2021-08-28 1:02 CGEL
2021-08-30 17:36 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: CGEL @ 2021-08-28 1:02 UTC (permalink / raw)
To: Jay Vosburgh
Cc: Veaceslav Falico, Andy Gospodarek, David S . Miller,
Jakub Kicinski, netdev, linux-kernel, Changcheng Deng,
Zeal Robot
From: Changcheng Deng <deng.changcheng@zte.com.cn>
Fix the following coccinelle reports:
./drivers/net/bonding/bond_alb.c:976:3-6 WARNING: Use BUG_ON instead of
if condition followed by BUG.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
---
drivers/net/bonding/bond_alb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 7d3752c..3288022 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -972,8 +972,7 @@ static int alb_upper_dev_walk(struct net_device *upper,
*/
if (netif_is_macvlan(upper) && !strict_match) {
tags = bond_verify_device_path(bond->dev, upper, 0);
- if (IS_ERR_OR_NULL(tags))
- BUG();
+ BUG_ON(IS_ERR_OR_NULL(tags));
alb_send_lp_vid(slave, upper->dev_addr,
tags[0].vlan_proto, tags[0].vlan_id);
kfree(tags);
--
1.8.3.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH linux-next] net: bonding: bond_alb: Replace if (cond) BUG() with BUG_ON()
2021-08-28 1:02 [PATCH linux-next] net: bonding: bond_alb: Replace if (cond) BUG() with BUG_ON() CGEL
@ 2021-08-30 17:36 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2021-08-30 17:36 UTC (permalink / raw)
To: CGEL
Cc: Jay Vosburgh, Veaceslav Falico, Andy Gospodarek,
David S . Miller, netdev, linux-kernel, Changcheng Deng,
Zeal Robot
On Fri, 27 Aug 2021 18:02:30 -0700 CGEL wrote:
> From: Changcheng Deng <deng.changcheng@zte.com.cn>
>
> Fix the following coccinelle reports:
>
> ./drivers/net/bonding/bond_alb.c:976:3-6 WARNING: Use BUG_ON instead of
> if condition followed by BUG.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
> ---
> drivers/net/bonding/bond_alb.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
> index 7d3752c..3288022 100644
> --- a/drivers/net/bonding/bond_alb.c
> +++ b/drivers/net/bonding/bond_alb.c
> @@ -972,8 +972,7 @@ static int alb_upper_dev_walk(struct net_device *upper,
> */
> if (netif_is_macvlan(upper) && !strict_match) {
> tags = bond_verify_device_path(bond->dev, upper, 0);
> - if (IS_ERR_OR_NULL(tags))
> - BUG();
> + BUG_ON(IS_ERR_OR_NULL(tags));
> alb_send_lp_vid(slave, upper->dev_addr,
> tags[0].vlan_proto, tags[0].vlan_id);
> kfree(tags);
The fact this code using is BUG() in the first place is more problematic
than not using BUG_ON(). Can it be converted to WARN_ON() + return?
Looks like alb_upper_dev_walk() returns int.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-30 17:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-28 1:02 [PATCH linux-next] net: bonding: bond_alb: Replace if (cond) BUG() with BUG_ON() CGEL
2021-08-30 17:36 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).