* [PATCH 1/4] media: pci: saa7164: Replace BUG() with BUG_ON()
@ 2016-12-24 22:31 Shyam Saini
2016-12-24 22:31 ` [PATCH 2/4] " Shyam Saini
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Shyam Saini @ 2016-12-24 22:31 UTC (permalink / raw)
To: mchehab; +Cc: linux-media, Shyam Saini
Replace BUG() with BUG_ON() using coccinelle
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);
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] media: pci: saa7164: Replace BUG() with BUG_ON()
2016-12-24 22:31 [PATCH 1/4] media: pci: saa7164: Replace BUG() with BUG_ON() Shyam Saini
@ 2016-12-24 22:31 ` Shyam Saini
2016-12-24 22:31 ` [PATCH 3/4] " Shyam Saini
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Shyam Saini @ 2016-12-24 22:31 UTC (permalink / raw)
To: mchehab; +Cc: linux-media, Shyam Saini
Replace BUG() with BUG_ON() using coccinelle
Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
---
drivers/media/pci/saa7164/saa7164-core.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/media/pci/saa7164/saa7164-core.c b/drivers/media/pci/saa7164/saa7164-core.c
index 03a1511..4c32649 100644
--- a/drivers/media/pci/saa7164/saa7164-core.c
+++ b/drivers/media/pci/saa7164/saa7164-core.c
@@ -591,8 +591,7 @@ static irqreturn_t saa7164_irq_ts(struct saa7164_port *port)
/* Find the current write point from the hardware */
wp = saa7164_readl(port->bufcounter);
- if (wp > (port->hwcfg.buffercount - 1))
- BUG();
+ BUG_ON(wp > (port->hwcfg.buffercount - 1));
/* Find the previous buffer to the current write point */
if (wp == 0)
@@ -604,8 +603,7 @@ static irqreturn_t saa7164_irq_ts(struct saa7164_port *port)
/* TODO: turn this into a worker thread */
list_for_each_safe(c, n, &port->dmaqueue.list) {
buf = list_entry(c, struct saa7164_buffer, list);
- if (i++ > port->hwcfg.buffercount)
- BUG();
+ BUG_ON(i++ > port->hwcfg.buffercount);
if (buf->idx == rp) {
/* Found the buffer, deal with it */
@@ -910,8 +908,7 @@ static int saa7164_port_init(struct saa7164_dev *dev, int portnr)
{
struct saa7164_port *port = NULL;
- if ((portnr < 0) || (portnr >= SAA7164_MAX_PORTS))
- BUG();
+ BUG_ON((portnr < 0) || (portnr >= SAA7164_MAX_PORTS));
port = &dev->ports[portnr];
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] media: pci: saa7164: Replace BUG() with BUG_ON()
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 ` Shyam Saini
2016-12-24 22:31 ` [PATCH 4/4] " Shyam Saini
2017-02-03 13:46 ` [PATCH 1/4] " Mauro Carvalho Chehab
3 siblings, 0 replies; 5+ messages in thread
From: Shyam Saini @ 2016-12-24 22:31 UTC (permalink / raw)
To: mchehab; +Cc: linux-media, Shyam Saini
Replace BUG() with BUG_ON() using coccinelle
Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
---
drivers/media/pci/saa7164/saa7164-dvb.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/media/pci/saa7164/saa7164-dvb.c b/drivers/media/pci/saa7164/saa7164-dvb.c
index cd3eeda..cf0e10a 100644
--- a/drivers/media/pci/saa7164/saa7164-dvb.c
+++ b/drivers/media/pci/saa7164/saa7164-dvb.c
@@ -351,8 +351,7 @@ static int dvb_register(struct saa7164_port *port)
dprintk(DBGLVL_DVB, "%s(port=%d)\n", __func__, port->nr);
- if (port->type != SAA7164_MPEG_DVB)
- BUG();
+ BUG_ON(port->type != SAA7164_MPEG_DVB);
/* Sanity check that the PCI configuration space is active */
if (port->hwcfg.BARLocation == 0) {
@@ -493,8 +492,7 @@ int saa7164_dvb_unregister(struct saa7164_port *port)
dprintk(DBGLVL_DVB, "%s()\n", __func__);
- if (port->type != SAA7164_MPEG_DVB)
- BUG();
+ BUG_ON(port->type != SAA7164_MPEG_DVB);
/* Remove any allocated buffers */
mutex_lock(&port->dmaqueue_lock);
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] media: pci: saa7164: Replace BUG() with BUG_ON()
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 ` Shyam Saini
2017-02-03 13:46 ` [PATCH 1/4] " Mauro Carvalho Chehab
3 siblings, 0 replies; 5+ messages in thread
From: Shyam Saini @ 2016-12-24 22:31 UTC (permalink / raw)
To: mchehab; +Cc: linux-media, Shyam Saini
Replace BUG() with BUG_ON() using coccinelle
Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
---
drivers/media/pci/saa7164/saa7164-vbi.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/media/pci/saa7164/saa7164-vbi.c b/drivers/media/pci/saa7164/saa7164-vbi.c
index e5dcb81..73e42c9 100644
--- a/drivers/media/pci/saa7164/saa7164-vbi.c
+++ b/drivers/media/pci/saa7164/saa7164-vbi.c
@@ -722,8 +722,7 @@ int saa7164_vbi_register(struct saa7164_port *port)
dprintk(DBGLVL_VBI, "%s()\n", __func__);
- if (port->type != SAA7164_MPEG_VBI)
- BUG();
+ BUG_ON(port->type != SAA7164_MPEG_VBI);
/* Sanity check that the PCI configuration space is active */
if (port->hwcfg.BARLocation == 0) {
@@ -775,8 +774,7 @@ void saa7164_vbi_unregister(struct saa7164_port *port)
dprintk(DBGLVL_VBI, "%s(port=%d)\n", __func__, port->nr);
- if (port->type != SAA7164_MPEG_VBI)
- BUG();
+ BUG_ON(port->type != SAA7164_MPEG_VBI);
if (port->v4l_device) {
if (port->v4l_device->minor != -1)
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/4] media: pci: saa7164: Replace BUG() with BUG_ON()
2016-12-24 22:31 [PATCH 1/4] media: pci: saa7164: Replace BUG() with BUG_ON() Shyam Saini
` (2 preceding siblings ...)
2016-12-24 22:31 ` [PATCH 4/4] " Shyam Saini
@ 2017-02-03 13:46 ` Mauro Carvalho Chehab
3 siblings, 0 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2017-02-03 13:46 UTC (permalink / raw)
To: Shyam Saini; +Cc: mchehab, linux-media
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-02-03 13:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 1/4] " Mauro Carvalho Chehab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).