aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2011-04-19 12:00:01 -0400
committerDavid Sterba <dsterba@suse.cz>2011-05-02 07:57:20 -0400
commitc704005d886cf0bc9bc3974eb009b22fe0da32c7 (patch)
treeb9effb8d686af95ca92782697b75a70bf34a3964 /fs/btrfs/inode.c
parent4891aca2dac612a2f21a3278d9906ade13b55788 (diff)
btrfs: unify checking of IS_ERR and null
use IS_ERR_OR_NULL when possible, done by this coccinelle script: @ match @ identifier id; @@ ( - BUG_ON(IS_ERR(id) || !id); + BUG_ON(IS_ERR_OR_NULL(id)); | - IS_ERR(id) || !id + IS_ERR_OR_NULL(id) | - !id || IS_ERR(id) + IS_ERR_OR_NULL(id) ) Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index fc966472e3ad..ba760c3ced28 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1855,7 +1855,7 @@ static int btrfs_io_failed_hook(struct bio *failed_bio,
1855 } 1855 }
1856 read_unlock(&em_tree->lock); 1856 read_unlock(&em_tree->lock);
1857 1857
1858 if (!em || IS_ERR(em)) { 1858 if (IS_ERR_OR_NULL(em)) {
1859 kfree(failrec); 1859 kfree(failrec);
1860 return -EIO; 1860 return -EIO;
1861 } 1861 }
@@ -3006,7 +3006,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
3006 3006
3007 di = btrfs_lookup_dir_item(trans, root, path, dir->i_ino, 3007 di = btrfs_lookup_dir_item(trans, root, path, dir->i_ino,
3008 name, name_len, -1); 3008 name, name_len, -1);
3009 BUG_ON(!di || IS_ERR(di)); 3009 BUG_ON(IS_ERR_OR_NULL(di));
3010 3010
3011 leaf = path->nodes[0]; 3011 leaf = path->nodes[0];
3012 btrfs_dir_item_key_to_cpu(leaf, di, &key); 3012 btrfs_dir_item_key_to_cpu(leaf, di, &key);
@@ -3022,7 +3022,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
3022 BUG_ON(ret != -ENOENT); 3022 BUG_ON(ret != -ENOENT);
3023 di = btrfs_search_dir_index_item(root, path, dir->i_ino, 3023 di = btrfs_search_dir_index_item(root, path, dir->i_ino,
3024 name, name_len); 3024 name, name_len);
3025 BUG_ON(!di || IS_ERR(di)); 3025 BUG_ON(IS_ERR_OR_NULL(di));
3026 3026
3027 leaf = path->nodes[0]; 3027 leaf = path->nodes[0];
3028 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); 3028 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
@@ -3032,7 +3032,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
3032 3032
3033 di = btrfs_lookup_dir_index_item(trans, root, path, dir->i_ino, 3033 di = btrfs_lookup_dir_index_item(trans, root, path, dir->i_ino,
3034 index, name, name_len, -1); 3034 index, name, name_len, -1);
3035 BUG_ON(!di || IS_ERR(di)); 3035 BUG_ON(IS_ERR_OR_NULL(di));
3036 3036
3037 leaf = path->nodes[0]; 3037 leaf = path->nodes[0];
3038 btrfs_dir_item_key_to_cpu(leaf, di, &key); 3038 btrfs_dir_item_key_to_cpu(leaf, di, &key);
@@ -3635,7 +3635,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size)
3635 while (1) { 3635 while (1) {
3636 em = btrfs_get_extent(inode, NULL, 0, cur_offset, 3636 em = btrfs_get_extent(inode, NULL, 0, cur_offset,
3637 block_end - cur_offset, 0); 3637 block_end - cur_offset, 0);
3638 BUG_ON(IS_ERR(em) || !em); 3638 BUG_ON(IS_ERR_OR_NULL(em));
3639 last_byte = min(extent_map_end(em), block_end); 3639 last_byte = min(extent_map_end(em), block_end);
3640 last_byte = (last_byte + mask) & ~mask; 3640 last_byte = (last_byte + mask) & ~mask;
3641 if (!test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) { 3641 if (!test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) {
@@ -3841,7 +3841,7 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,
3841 if (IS_ERR(di)) 3841 if (IS_ERR(di))
3842 ret = PTR_ERR(di); 3842 ret = PTR_ERR(di);
3843 3843
3844 if (!di || IS_ERR(di)) 3844 if (IS_ERR_OR_NULL(di))
3845 goto out_err; 3845 goto out_err;
3846 3846
3847 btrfs_dir_item_key_to_cpu(path->nodes[0], di, location); 3847 btrfs_dir_item_key_to_cpu(path->nodes[0], di, location);