All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Nazarewicz <mina86@mina86.com>
To: Felipe Balbi <balbi@ti.com>, Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Michal Nazarewicz <mina86@mina86.com>
Subject: [PATCH 2/2] usb: f_fs: replace BUG in dead-code with less serious WARN_ON
Date: Wed, 10 Sep 2014 17:50:25 +0200	[thread overview]
Message-ID: <1410364225-6087-2-git-send-email-mina86@mina86.com> (raw)
In-Reply-To: <1410364225-6087-1-git-send-email-mina86@mina86.com>

Even though the BUG() in __ffs_event_add is a dead-code, it is still
better to warn rather then crash the system if that code ever gets
executed.

Suggested-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
---
 This has been compile tested only.

 drivers/usb/gadget/function/f_fs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index ec50e0d..74d48b3 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -2321,7 +2321,9 @@ static void __ffs_event_add(struct ffs_data *ffs,
 		break;
 
 	default:
-		BUG();
+		pr_vdebug("%d: unknown event, this should not happen\n", type);
+		WARN_ON(1);
+		return;
 	}
 
 	{
-- 
2.1.0.rc2.206.gedb03e5


  reply	other threads:[~2014-09-10 15:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10 15:50 [PATCH 1/2] usb: f_fs: refactor and document __ffs_ep0_read_events better Michal Nazarewicz
2014-09-10 15:50 ` Michal Nazarewicz [this message]
2014-09-10 16:13   ` [PATCH 2/2] usb: f_fs: replace BUG in dead-code with less serious WARN_ON Felipe Balbi
2014-09-11 16:52     ` [PATCHv2] " Michal Nazarewicz
2014-09-11 16:56       ` Felipe Balbi

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=1410364225-6087-2-git-send-email-mina86@mina86.com \
    --to=mina86@mina86.com \
    --cc=balbi@ti.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@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.