[media] usb drivers: use BUG_ON() instead of if () BUG
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 19 May 2015 11:00:56 +0000 (08:00 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 9 Jun 2015 21:30:09 +0000 (18:30 -0300)
Some USB drivers have a logic at the VB buffer handling like:
if (in_interrupt())
BUG();
Use, instead:
BUG_ON(in_interrupt());

Btw, this logic looks weird on my eyes. We should convert them
to use VB2, in order to avoid those crappy things.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/usb/cx231xx/cx231xx-417.c
drivers/media/usb/cx231xx/cx231xx-vbi.c
drivers/media/usb/cx231xx/cx231xx-video.c
drivers/media/usb/tm6000/tm6000-video.c
drivers/media/usb/zr364xx/zr364xx.c

index 855a708387c679f8f0f26c4e810a9b7d94eea0bb..47a98a2014a5bb619744a77e4b58f51c2e764399 100644 (file)
@@ -1249,8 +1249,7 @@ static void free_buffer(struct videobuf_queue *vq, struct cx231xx_buffer *buf)
        struct cx231xx *dev = fh->dev;
        unsigned long flags = 0;
 
-       if (in_interrupt())
-               BUG();
+       BUG_ON(in_interrupt());
 
        spin_lock_irqsave(&dev->video_mode.slock, flags);
        if (dev->USE_ISO) {
index 80261ac40208ecf11bde7f3945e96e0f659aa986..a08014d20a5c2f12af14dd7f477802b587743902 100644 (file)
@@ -192,8 +192,7 @@ static void free_buffer(struct videobuf_queue *vq, struct cx231xx_buffer *buf)
        struct cx231xx_fh *fh = vq->priv_data;
        struct cx231xx *dev = fh->dev;
        unsigned long flags = 0;
-       if (in_interrupt())
-               BUG();
+       BUG_ON(in_interrupt());
 
        /* We used to wait for the buffer to finish here, but this didn't work
           because, as we were keeping the state as VIDEOBUF_QUEUED,
index af44f2d1c0a1a28e2d13c2bbacdddccb0b6a2cad..c6ff8968286a6f9e07676f38b47bac9b69b51661 100644 (file)
@@ -749,8 +749,7 @@ static void free_buffer(struct videobuf_queue *vq, struct cx231xx_buffer *buf)
        struct cx231xx *dev = fh->dev;
        unsigned long flags = 0;
 
-       if (in_interrupt())
-               BUG();
+       BUG_ON(in_interrupt());
 
        /* We used to wait for the buffer to finish here, but this didn't work
           because, as we were keeping the state as VIDEOBUF_QUEUED,
index 5287d29602824acc5ca77b078cc3c87e43386be1..fa5e8bda2ae4a7dfea2135fafd25ce02b8a39662 100644 (file)
@@ -714,8 +714,7 @@ static void free_buffer(struct videobuf_queue *vq, struct tm6000_buffer *buf)
        struct tm6000_core   *dev = fh->dev;
        unsigned long flags;
 
-       if (in_interrupt())
-               BUG();
+       BUG_ON(in_interrupt());
 
        /* We used to wait for the buffer to finish here, but this didn't work
           because, as we were keeping the state as VIDEOBUF_QUEUED,
index ca850316d379062271352f7abb54d3bd4cb7c84c..7433ba5c4bad8bdf044435977409856b54c9ff9b 100644 (file)
@@ -377,8 +377,7 @@ static void free_buffer(struct videobuf_queue *vq, struct zr364xx_buffer *buf)
 {
        _DBG("%s\n", __func__);
 
-       if (in_interrupt())
-               BUG();
+       BUG_ON(in_interrupt());
 
        videobuf_vmalloc_free(&buf->vb);
        buf->vb.state = VIDEOBUF_NEEDS_INIT;