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

[-- Attachment #1: Type: text/plain, Size: 989 bytes --]

On Wed, Sep 10, 2014 at 05:50:25PM +0200, Michal Nazarewicz wrote:
> 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);

WARN(1, "unknown event type %d\n", type);
Then you can drop pr_vdebug();

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2014-09-10 16:13 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 ` [PATCH 2/2] usb: f_fs: replace BUG in dead-code with less serious WARN_ON Michal Nazarewicz
2014-09-10 16:13   ` Felipe Balbi [this message]
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=20140910161337.GL667@saruman.home \
    --to=balbi@ti.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mina86@mina86.com \
    /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.