All of lore.kernel.org
 help / color / mirror / Atom feed
From: sfeldma@gmail.com
To: netdev@vger.kernel.org
Cc: jiri@resnulli.us, dsahern@gmail.com
Subject: [PATCH net-next] switchdev: change BUG_ON to WARN for attr set failure case
Date: Thu, 11 Jun 2015 11:20:42 -0700	[thread overview]
Message-ID: <1434046842-24601-1-git-send-email-sfeldma@gmail.com> (raw)

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

             reply	other threads:[~2015-06-11 18:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11 18:20 sfeldma [this message]
2015-06-11 23:27 ` [PATCH net-next] switchdev: change BUG_ON to WARN for attr set failure case David Miller
2015-06-17 22:38   ` Scott Feldman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1434046842-24601-1-git-send-email-sfeldma@gmail.com \
    --to=sfeldma@gmail.com \
    --cc=dsahern@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.