kfifo: use BUG_ON
authorHimangi Saraogi <himangi774@gmail.com>
Fri, 8 Aug 2014 21:22:44 +0000 (14:22 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 Aug 2014 22:57:25 +0000 (15:57 -0700)
Use BUG_ON(x) rather than if(x) BUG();

The semantic patch that fixes this problem is as follows:

// <smpl>
@@ identifier x; @@
-if (!x) BUG();
+BUG_ON(!x);
// </smpl>

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Cc: Stefani Seibold <stefani@seibold.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/kfifo.c

index d79b9d2..90ba1eb 100644 (file)
@@ -561,8 +561,7 @@ EXPORT_SYMBOL(__kfifo_to_user_r);
 unsigned int __kfifo_dma_in_prepare_r(struct __kfifo *fifo,
        struct scatterlist *sgl, int nents, unsigned int len, size_t recsize)
 {
-       if (!nents)
-               BUG();
+       BUG_ON(!nents);
 
        len = __kfifo_max_r(len, recsize);
 
@@ -585,8 +584,7 @@ EXPORT_SYMBOL(__kfifo_dma_in_finish_r);
 unsigned int __kfifo_dma_out_prepare_r(struct __kfifo *fifo,
        struct scatterlist *sgl, int nents, unsigned int len, size_t recsize)
 {
-       if (!nents)
-               BUG();
+       BUG_ON(!nents);
 
        len = __kfifo_max_r(len, recsize);