]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
fs/ext2: use BUG_ON
authorJulia Lawall <julia@diku.dk>
Mon, 28 Apr 2008 09:16:02 +0000 (02:16 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 28 Apr 2008 15:58:43 +0000 (08:58 -0700)
if (...) BUG(); should be replaced with BUG_ON(...) when the test has no
side-effects to allow a definition of BUG_ON that drops the code completely.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@ disable unlikely @ expression E,f; @@

(
  if (<... f(...) ...>) { BUG(); }
|
- if (unlikely(E)) { BUG(); }
+ BUG_ON(E);
)

@@ expression E,f; @@

(
  if (<... f(...) ...>) { BUG(); }
|
- if (E) { BUG(); }
+ BUG_ON(E);
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ext2/balloc.c
fs/ext2/dir.c

index e7b2bafa1dd91cd69f8caf4597654a6355c3a666..c834f512dce5fc21026a2345ca6366d3092c2e77 100644 (file)
@@ -245,8 +245,7 @@ restart:
                prev = rsv;
        }
        printk("Window map complete.\n");
-       if (bad)
-               BUG();
+       BUG_ON(bad);
 }
 #define rsv_window_dump(root, verbose) \
        __rsv_window_dump((root), (verbose), __FUNCTION__)
index a0995eb2dc232c2b7ddc79df644482a9a651c9e0..dd9dbb25eab2b2a64acdc8b999e94935b2676478 100644 (file)
@@ -41,8 +41,8 @@ static inline __le16 ext2_rec_len_to_disk(unsigned len)
 {
        if (len == (1 << 16))
                return cpu_to_le16(EXT2_MAX_REC_LEN);
-       else if (len > (1 << 16))
-               BUG();
+       else
+               BUG_ON(len > (1 << 16));
        return cpu_to_le16(len);
 }