fs/reiserfs/journal.c: fix sparse context imbalance warning
authorFabian Frederick <fabf@skynet.be>
Mon, 13 Oct 2014 22:53:29 +0000 (15:53 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 14 Oct 2014 00:18:20 +0000 (02:18 +0200)
Merge conditional unlock/lock in the same condition to avoid sparse
warning:

  fs/reiserfs/journal.c:703:36: warning: context imbalance in 'add_to_chunk' - unexpected unlock

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Cc: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/reiserfs/journal.c

index a88b1b3..d571e17 100644 (file)
@@ -699,11 +699,13 @@ static int add_to_chunk(struct buffer_chunk *chunk, struct buffer_head *bh,
        chunk->bh[chunk->nr++] = bh;
        if (chunk->nr >= CHUNK_SIZE) {
                ret = 1;
-               if (lock)
+               if (lock) {
                        spin_unlock(lock);
-               fn(chunk);
-               if (lock)
+                       fn(chunk);
                        spin_lock(lock);
+               } else {
+                       fn(chunk);
+               }
        }
        return ret;
 }