All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Shyam Saini <mayhs11saini@gmail.com>
Cc: mchehab@kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH 1/4] media: pci: saa7164: Replace BUG() with BUG_ON()
Date: Fri, 3 Feb 2017 11:46:27 -0200	[thread overview]
Message-ID: <20170203114627.65bf6fec@vento.lan> (raw)
In-Reply-To: <1482618702-13755-1-git-send-email-mayhs11saini@gmail.com>

Em Sun, 25 Dec 2016 04:01:39 +0530
Shyam Saini <mayhs11saini@gmail.com> escreveu:

> Replace BUG() with BUG_ON() using coccinelle

First of all, don't send one patch per file, but one patch per driver.

Also, as checkpatch warns:

	WARNING: Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON()


I suspect that very few (if any) BUG() calls on this driver would require
to crash the Kernel.


> 
> Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
> ---
>  drivers/media/pci/saa7164/saa7164-buffer.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/pci/saa7164/saa7164-buffer.c b/drivers/media/pci/saa7164/saa7164-buffer.c
> index 62c3450..7d28d46 100644
> --- a/drivers/media/pci/saa7164/saa7164-buffer.c
> +++ b/drivers/media/pci/saa7164/saa7164-buffer.c
> @@ -266,15 +266,13 @@ int saa7164_buffer_cfg_port(struct saa7164_port *port)
>  	list_for_each_safe(c, n, &port->dmaqueue.list) {
>  		buf = list_entry(c, struct saa7164_buffer, list);
>  
> -		if (buf->flags != SAA7164_BUFFER_FREE)
> -			BUG();
> +		BUG_ON(buf->flags != SAA7164_BUFFER_FREE);
>  
>  		/* Place the buffer in the h/w queue */
>  		saa7164_buffer_activate(buf, i);
>  
>  		/* Don't exceed the device maximum # bufs */
> -		if (i++ > port->hwcfg.buffercount)
> -			BUG();
> +		BUG_ON(i++ > port->hwcfg.buffercount);
>  
>  	}
>  	mutex_unlock(&port->dmaqueue_lock);



Thanks,
Mauro

      parent reply	other threads:[~2017-02-03 13:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-24 22:31 [PATCH 1/4] media: pci: saa7164: Replace BUG() with BUG_ON() Shyam Saini
2016-12-24 22:31 ` [PATCH 2/4] " Shyam Saini
2016-12-24 22:31 ` [PATCH 3/4] " Shyam Saini
2016-12-24 22:31 ` [PATCH 4/4] " Shyam Saini
2017-02-03 13:46 ` Mauro Carvalho Chehab [this message]

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=20170203114627.65bf6fec@vento.lan \
    --to=mchehab@s-opensource.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mayhs11saini@gmail.com \
    --cc=mchehab@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.