]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ocfs2: Use BUG_ON
authorJulia Lawall <julia@diku.dk>
Tue, 4 Mar 2008 23:21:05 +0000 (15:21 -0800)
committerMark Fasheh <mfasheh@suse.com>
Fri, 18 Apr 2008 15:56:11 +0000 (08:56 -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: Mark Fasheh <mfasheh@suse.com>
fs/ocfs2/alloc.c
fs/ocfs2/journal.c

index a26882144e8fa577624a404f41a2dc4269194812..41f84c92094fc114854f9dfd5ff98f4f470a3bec 100644 (file)
@@ -1029,8 +1029,7 @@ static void ocfs2_rotate_leaf(struct ocfs2_extent_list *el,
        BUG_ON(!next_free);
 
        /* The tree code before us didn't allow enough room in the leaf. */
-       if (el->l_next_free_rec == el->l_count && !has_empty)
-               BUG();
+       BUG_ON(el->l_next_free_rec == el->l_count && !has_empty);
 
        /*
         * The easiest way to approach this is to just remove the
index bffd2d714f671ae2c15978eb0eaff47811a955bc..9698338adc3915e66a3db0eda77268e33b51f607 100644 (file)
@@ -717,8 +717,7 @@ int ocfs2_journal_load(struct ocfs2_journal *journal, int local)
 
        mlog_entry_void();
 
-       if (!journal)
-               BUG();
+       BUG_ON(!journal);
 
        osb = journal->j_osb;