Re: [PATCH 1/4] media: pci: saa7164: Replace BUG() with BUG_ON()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Em Sun, 25 Dec 2016 04:01:39 +0530
Shyam Saini <mayhs11saini@xxxxxxxxx> 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@xxxxxxxxx>
> ---
>  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
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux