mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 02:01:18 -04:00
btrfs: prefer IS_ERR_OR_NULL() over manual NULL check
Prefer using IS_ERR_OR_NULL() over using IS_ERR() and a manual NULL check. IS_ERR_OR_NULL() already uses likely(!ptr) internally. checkpatch does not like nesting it: > WARNING: nested (un)?likely() calls, IS_ERR_OR_NULL already uses > unlikely() internally Remove the explicit use of likely(). Change generated with coccinelle. Signed-off-by: Philipp Hahn <phahn-oss@avm.de> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
94e445085c
commit
e526779648
@@ -4691,7 +4691,7 @@ static noinline int may_destroy_subvol(struct btrfs_root *root)
|
||||
dir_id = btrfs_super_root_dir(fs_info->super_copy);
|
||||
di = btrfs_lookup_dir_item(NULL, fs_info->tree_root, path,
|
||||
dir_id, &name, 0);
|
||||
if (di && !IS_ERR(di)) {
|
||||
if (!IS_ERR_OR_NULL(di)) {
|
||||
btrfs_dir_item_key_to_cpu(path->nodes[0], di, &key);
|
||||
if (key.objectid == btrfs_root_id(root)) {
|
||||
ret = -EPERM;
|
||||
|
||||
@@ -1754,7 +1754,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
|
||||
dir_item = btrfs_lookup_dir_item(NULL, parent_root, path,
|
||||
btrfs_ino(parent_inode),
|
||||
&fname.disk_name, 0);
|
||||
if (unlikely(dir_item != NULL && !IS_ERR(dir_item))) {
|
||||
if (!IS_ERR_OR_NULL(dir_item)) {
|
||||
pending->error = -EEXIST;
|
||||
goto dir_item_existed;
|
||||
} else if (IS_ERR(dir_item)) {
|
||||
|
||||
@@ -5801,7 +5801,7 @@ static int btrfs_check_ref_name_override(struct extent_buffer *eb,
|
||||
name_str.len = this_name_len;
|
||||
di = btrfs_lookup_dir_item(NULL, inode->root, search_path,
|
||||
parent, &name_str, 0);
|
||||
if (di && !IS_ERR(di)) {
|
||||
if (!IS_ERR_OR_NULL(di)) {
|
||||
struct btrfs_key di_key;
|
||||
|
||||
btrfs_dir_item_key_to_cpu(search_path->nodes[0],
|
||||
|
||||
@@ -513,7 +513,7 @@ int btrfs_uuid_scan_kthread(void *data)
|
||||
|
||||
out:
|
||||
btrfs_free_path(path);
|
||||
if (trans && !IS_ERR(trans))
|
||||
if (!IS_ERR_OR_NULL(trans))
|
||||
btrfs_end_transaction(trans);
|
||||
if (ret)
|
||||
btrfs_warn(fs_info, "btrfs_uuid_scan_kthread failed %d", ret);
|
||||
|
||||
Reference in New Issue
Block a user