Skip to content

Commit 8d9e220

Browse files
Al Virokdave
authored andcommitted
btrfs: simplify IS_ERR/PTR_ERR checks
IS_ERR(p) && PTR_ERR(p) == n is a weird way to spell p == ERR_PTR(n). Signed-off-by: Al Viro <[email protected]> Reviewed-by: David Sterba <[email protected]> Reviewed-by: Nikolay Borisov <[email protected]> [ update changelog ] Signed-off-by: David Sterba <[email protected]>
1 parent 2e19f1f commit 8d9e220

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

fs/btrfs/transaction.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ btrfs_attach_transaction_barrier(struct btrfs_root *root)
680680

681681
trans = start_transaction(root, 0, TRANS_ATTACH,
682682
BTRFS_RESERVE_NO_FLUSH, true);
683-
if (IS_ERR(trans) && PTR_ERR(trans) == -ENOENT)
683+
if (trans == ERR_PTR(-ENOENT))
684684
btrfs_wait_for_commit(root->fs_info, 0);
685685

686686
return trans;

fs/btrfs/tree-log.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,7 +2181,7 @@ static noinline int check_item_in_log(struct btrfs_trans_handle *trans,
21812181
dir_key->offset,
21822182
name, name_len, 0);
21832183
}
2184-
if (!log_di || (IS_ERR(log_di) && PTR_ERR(log_di) == -ENOENT)) {
2184+
if (!log_di || log_di == ERR_PTR(-ENOENT)) {
21852185
btrfs_dir_item_key_to_cpu(eb, di, &location);
21862186
btrfs_release_path(path);
21872187
btrfs_release_path(log_path);
@@ -5011,8 +5011,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
50115011
* we don't need to do more work nor fallback to
50125012
* a transaction commit.
50135013
*/
5014-
if (IS_ERR(other_inode) &&
5015-
PTR_ERR(other_inode) == -ENOENT) {
5014+
if (other_inode == ERR_PTR(-ENOENT)) {
50165015
goto next_key;
50175016
} else if (IS_ERR(other_inode)) {
50185017
err = PTR_ERR(other_inode);

0 commit comments

Comments
 (0)