Skip to content

Commit

Permalink
Btrfs: Correct redundant test in add_inode_ref
Browse files Browse the repository at this point in the history
dir has already been tested.  It seems that this test should be on the
recently returned value inode.

A simplified version of the semantic match that finds this problem is as
follows: (http://www.emn.fr/x-info/coccinelle/)

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Julia Lawall authored and Chris Mason committed Jul 27, 2009
1 parent 9779b72 commit 631c07c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/tree-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
return -ENOENT;

inode = read_one_inode(root, key->objectid);
BUG_ON(!dir);
BUG_ON(!inode);

ref_ptr = btrfs_item_ptr_offset(eb, slot);
ref_end = ref_ptr + btrfs_item_size_nr(eb, slot);
Expand Down

0 comments on commit 631c07c

Please sign in to comment.