diff options
| author | Philipp Hahn <phahn-oss@avm.de> | 2026-03-10 14:48:28 +0300 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-04-07 19:56:02 +0300 |
| commit | e5267796482fad93ee7948c7cbc37f32046244f7 (patch) | |
| tree | 49873c743e0efdff1876a00dc4414e417b39b0f5 | |
| parent | 94e445085c7be52c1cc937959fa8254b56cdf672 (diff) | |
| download | linux-e5267796482fad93ee7948c7cbc37f32046244f7.tar.xz | |
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>
| -rw-r--r-- | fs/btrfs/inode.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/transaction.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/tree-log.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/uuid-tree.c | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index c1abeb72069c..8d97a8ad3858 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -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; diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 79c488f120b2..4358f4b63057 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -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)) { diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index af8de67d1304..a87fdfd465b3 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -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], diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c index 276f0eb874d4..467dff7212d6 100644 --- a/fs/btrfs/uuid-tree.c +++ b/fs/btrfs/uuid-tree.c @@ -513,7 +513,7 @@ skip: 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); |
