netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] switchdev: change BUG_ON to WARN for attr set failure case
@ 2015-06-11 18:20 sfeldma
  2015-06-11 23:27 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: sfeldma @ 2015-06-11 18:20 UTC (permalink / raw)
  To: netdev; +Cc: jiri, dsahern

From: Scott Feldman <sfeldma@gmail.com>

This particular BUG_ON condition was checking for attr set err in the
COMMIT phase, which isn't expected (it's a driver bug if PREPARE phase is
OK but COMMIT fails).  But BUG_ON() is too strong for this case, so change
to WARN().  BUG_ON() would be warranted if the system was corrupted beyond
repair, but this is not the case here.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
---
 net/switchdev/switchdev.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 658bc3a..a5d0f8e 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -184,7 +184,8 @@ int switchdev_port_attr_set(struct net_device *dev, struct switchdev_attr *attr)
 
 	attr->trans = SWITCHDEV_TRANS_COMMIT;
 	err = __switchdev_port_attr_set(dev, attr);
-	BUG_ON(err);
+	WARN(err, "%s: Commit of attribute (id=%d) failed.\n",
+	     dev->name, attr->id);
 
 	return err;
 }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] switchdev: change BUG_ON to WARN for attr set failure case
  2015-06-11 18:20 [PATCH net-next] switchdev: change BUG_ON to WARN for attr set failure case sfeldma
@ 2015-06-11 23:27 ` David Miller
  2015-06-17 22:38   ` Scott Feldman
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2015-06-11 23:27 UTC (permalink / raw)
  To: sfeldma; +Cc: netdev, jiri, dsahern

From: sfeldma@gmail.com
Date: Thu, 11 Jun 2015 11:20:42 -0700

> From: Scott Feldman <sfeldma@gmail.com>
> 
> This particular BUG_ON condition was checking for attr set err in the
> COMMIT phase, which isn't expected (it's a driver bug if PREPARE phase is
> OK but COMMIT fails).  But BUG_ON() is too strong for this case, so change
> to WARN().  BUG_ON() would be warranted if the system was corrupted beyond
> repair, but this is not the case here.
> 
> Signed-off-by: Scott Feldman <sfeldma@gmail.com>

Applied, thanks Scott.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] switchdev: change BUG_ON to WARN for attr set failure case
  2015-06-11 23:27 ` David Miller
@ 2015-06-17 22:38   ` Scott Feldman
  0 siblings, 0 replies; 3+ messages in thread
From: Scott Feldman @ 2015-06-17 22:38 UTC (permalink / raw)
  To: David Miller; +Cc: Netdev, Jiří Pírko, David Ahern

On Thu, Jun 11, 2015 at 4:27 PM, David Miller <davem@davemloft.net> wrote:
> From: sfeldma@gmail.com
> Date: Thu, 11 Jun 2015 11:20:42 -0700
>
>> From: Scott Feldman <sfeldma@gmail.com>
>>
>> This particular BUG_ON condition was checking for attr set err in the
>> COMMIT phase, which isn't expected (it's a driver bug if PREPARE phase is
>> OK but COMMIT fails).  But BUG_ON() is too strong for this case, so change
>> to WARN().  BUG_ON() would be warranted if the system was corrupted beyond
>> repair, but this is not the case here.
>>
>> Signed-off-by: Scott Feldman <sfeldma@gmail.com>
>
> Applied, thanks Scott.

I think this one slipped thru the cracks.  I'm not seeing it in net-next.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-17 22:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-11 18:20 [PATCH net-next] switchdev: change BUG_ON to WARN for attr set failure case sfeldma
2015-06-11 23:27 ` David Miller
2015-06-17 22:38   ` Scott Feldman

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