From: Philipp Hahn <phahn-oss@avm.de>
To: amd-gfx@lists.freedesktop.org, apparmor@lists.ubuntu.com,
bpf@vger.kernel.org, ceph-devel@vger.kernel.org, cocci@inria.fr,
dm-devel@lists.linux.dev, dri-devel@lists.freedesktop.org,
gfs2@lists.linux.dev, intel-gfx@lists.freedesktop.org,
intel-wired-lan@lists.osuosl.org, iommu@lists.linux.dev,
kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-block@vger.kernel.org, linux-bluetooth@vger.kernel.org,
linux-btrfs@vger.kernel.org, linux-cifs@vger.kernel.org,
linux-clk@vger.kernel.org, linux-erofs@lists.ozlabs.org,
linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-hyperv@vger.kernel.org,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-leds@vger.kernel.org, linux-media@vger.kernel.org,
linux-mips@vger.kernel.org, linux-mm@kvack.org,
linux-modules@vger.kernel.org, linux-mtd@lists.infradead.org,
linux-nfs@vger.kernel.org, linux-omap@vger.kernel.org,
linux-phy@lists.infradead.org, linux-pm@vger.kernel.org,
linux-rockchip@lists.infradead.org, linux-s390@vger.kernel.org,
linux-scsi@vger.kernel.org, linux-sctp@vger.kernel.org,
linux-security-module@vger.kernel.org, linux-sh@vger.kernel.org,
linux-sound@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-trace-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
ntfs3@lists.linux.dev, samba-technical@lists.samba.org,
sched-ext@lists.linux.dev, target-devel@vger.kernel.org,
tipc-discussion@lists.sourceforge.net, v9fs@lists.linux.dev,
Philipp Hahn <phahn-oss@avm.de>
Cc: Chris Mason <clm@fb.com>, David Sterba <dsterba@suse.com>
Subject: [PATCH 02/61] btrfs: Prefer IS_ERR_OR_NULL over manual NULL check
Date: Tue, 10 Mar 2026 12:48:28 +0100 [thread overview]
Message-ID: <20260310-b4-is_err_or_null-v1-2-bd63b656022d@avm.de> (raw)
In-Reply-To: <20260310-b4-is_err_or_null-v1-0-bd63b656022d@avm.de>
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.
To: Chris Mason <clm@fb.com>
To: David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Philipp Hahn <phahn-oss@avm.de>
---
fs/btrfs/inode.c | 2 +-
fs/btrfs/transaction.c | 2 +-
fs/btrfs/tree-log.c | 2 +-
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 a11fcc9e9f502c559148cf33679014fb83b0d3b0..7c26a0bf56bf7309e2ce8256854d760b2d64b16a 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4683,7 +4683,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 7ef8c9b7dfc17a5133b6d2dc134e288975ed98d1..40b83037725033d3178dc3fc2c1e347ad2c597f7 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1737,7 +1737,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 780a06d592409b05fb42dc8079b019d23fe0cdfa..2e07ae393cf9d16f562047dd4cbfd7b4b9f2952e 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -5750,7 +5750,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 f24c14b9bb2fd7420b06263a5a0c4b889a859bc6..c497b287f3418933e532903b326b969416ae22cb 100644
--- a/fs/btrfs/uuid-tree.c
+++ b/fs/btrfs/uuid-tree.c
@@ -478,7 +478,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);
--
2.43.0
next prev parent reply other threads:[~2026-03-11 8:05 UTC|newest]
Thread overview: 131+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 11:48 [PATCH 00/61] treewide: Use IS_ERR_OR_NULL over manual NULL check - refactor Philipp Hahn
2026-03-10 11:48 ` [PATCH 01/61] Coccinelle: Prefer IS_ERR_OR_NULL over manual NULL check Philipp Hahn
2026-03-10 15:41 ` Markus Elfring
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-11 15:12 ` Markus Elfring
2026-03-10 11:48 ` Philipp Hahn [this message]
2026-03-11 21:27 ` Claude review: btrfs: " Claude Code Review Bot
2026-03-10 11:48 ` [PATCH 03/61] ceph: " Philipp Hahn
2026-03-10 18:13 ` Viacheslav Dubeyko
2026-03-11 8:16 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-10 11:48 ` [PATCH 04/61] ext4: " Philipp Hahn
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-10 11:48 ` [PATCH 05/61] smb: Prefer IS_ERR_OR_NULL over manual NULl check Philipp Hahn
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-10 11:48 ` [PATCH 06/61] 9p: Prefer IS_ERR_OR_NULL over manual NULL check Philipp Hahn
2026-03-10 13:45 ` Christian Schoenebeck
2026-03-11 8:17 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-10 11:48 ` [PATCH 07/61] erofs: " Philipp Hahn
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-10 11:48 ` [PATCH 08/61] fuse: " Philipp Hahn
2026-03-11 8:18 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-10 11:48 ` [PATCH 09/61] ntfs3: " Philipp Hahn
2026-03-10 11:48 ` [PATCH 10/61] gfs2: " Philipp Hahn
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-10 11:48 ` [PATCH 11/61] pstore: " Philipp Hahn
2026-03-10 11:48 ` [PATCH 12/61] quota: " Philipp Hahn
2026-03-11 8:19 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-10 11:48 ` [PATCH 13/61] squashfs: " Philipp Hahn
2026-03-11 8:19 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-10 11:48 ` [PATCH 14/61] seq_file: " Philipp Hahn
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-10 11:48 ` [PATCH 15/61] trace: " Philipp Hahn
2026-03-10 14:07 ` Steven Rostedt
2026-03-11 5:13 ` Masami Hiramatsu (Google)
2026-03-11 14:03 ` Steven Rostedt
2026-03-11 14:06 ` Geert Uytterhoeven
2026-03-10 11:48 ` [PATCH 16/61] sched: " Philipp Hahn
2026-03-11 9:16 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-10 11:48 ` [PATCH 17/61] module: " Philipp Hahn
2026-03-10 14:45 ` Aaron Tomlin
2026-03-11 9:18 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-10 11:48 ` [PATCH 18/61] sound: " Philipp Hahn
2026-03-10 12:28 ` Mark Brown
2026-03-10 11:48 ` [PATCH 19/61] kvm: " Philipp Hahn
2026-03-10 11:48 ` [PATCH 20/61] apparmor: " Philipp Hahn
2026-03-10 11:48 ` [PATCH 21/61] lib/test: " Philipp Hahn
2026-03-10 11:48 ` [PATCH 22/61] md: " Philipp Hahn
2026-03-11 9:19 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-10 11:48 ` [PATCH 23/61] net/ipv6: " Philipp Hahn
2026-03-10 11:48 ` [PATCH 24/61] net/9p: " Philipp Hahn
2026-03-10 13:47 ` Christian Schoenebeck
2026-03-11 9:19 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-10 11:48 ` [PATCH 25/61] net/bluetooth: " Philipp Hahn
2026-03-10 13:55 ` Bastien Nocera
2026-03-11 9:21 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-10 11:48 ` [PATCH 26/61] net/core: " Philipp Hahn
2026-03-10 11:48 ` [PATCH 27/61] net/netlink: " Philipp Hahn
2026-03-10 11:48 ` [PATCH 28/61] net/sched: " Philipp Hahn
2026-03-11 9:22 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-10 11:48 ` [PATCH 29/61] net/sctp: " Philipp Hahn
2026-03-10 11:48 ` [PATCH 30/61] net/sunrpc: " Philipp Hahn
2026-03-10 12:23 ` Jeff Layton
2026-03-10 13:23 ` Chuck Lever
2026-03-11 9:22 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-10 11:48 ` [PATCH 31/61] net/tipc: " Philipp Hahn
2026-03-10 11:48 ` [PATCH 32/61] net/wireless: " Philipp Hahn
2026-03-10 11:48 ` [PATCH 33/61] mm: " Philipp Hahn
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-10 11:49 ` [PATCH 34/61] arch/arm: " Philipp Hahn
2026-03-10 11:49 ` [PATCH 35/61] arch/mips: " Philipp Hahn
2026-03-10 11:49 ` [PATCH 36/61] arch/sh: " Philipp Hahn
2026-03-11 13:15 ` Geert Uytterhoeven
2026-03-10 11:49 ` [PATCH 37/61] drm: " Philipp Hahn
2026-03-10 12:08 ` Christian König
2026-03-10 12:40 ` Jani Nikula
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-10 11:49 ` [PATCH 38/61] net: " Philipp Hahn
2026-03-10 15:07 ` [EXTERNAL] " Elad Nachman
2026-03-11 0:16 ` Russell King (Oracle)
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-11 9:24 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-10 11:49 ` [PATCH 39/61] irqchip: " Philipp Hahn
2026-03-11 9:24 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-10 11:49 ` [PATCH 40/61] phy: " Philipp Hahn
2026-03-10 11:49 ` [PATCH 41/61] pinctrl: " Philipp Hahn
2026-03-11 9:32 ` Linus Walleij
2026-03-10 11:49 ` [PATCH 42/61] pmdomain: " Philipp Hahn
2026-03-10 11:49 ` [PATCH 43/61] s390: " Philipp Hahn
2026-03-10 11:49 ` [PATCH 44/61] target: " Philipp Hahn
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-10 11:49 ` [PATCH 45/61] thermal: " Philipp Hahn
2026-03-10 11:49 ` [PATCH 46/61] vfio: " Philipp Hahn
2026-03-10 12:53 ` Pranjal Shrivastava
2026-03-11 9:25 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-10 11:49 ` [PATCH 47/61] nfc: " Philipp Hahn
2026-03-10 11:49 ` [PATCH 48/61] mtd: " Philipp Hahn
2026-03-10 11:49 ` [PATCH 49/61] media: " Philipp Hahn
2026-03-11 9:25 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-10 11:49 ` [PATCH 50/61] iommu: " Philipp Hahn
2026-03-11 9:26 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-10 11:49 ` [PATCH 51/61] leds: " Philipp Hahn
2026-03-10 13:33 ` (subset) " Lee Jones
2026-03-10 11:49 ` [PATCH 52/61] gpib: " Philipp Hahn
2026-03-10 11:49 ` [PATCH 53/61] hyperv: " Philipp Hahn
2026-03-10 11:49 ` [PATCH 54/61] aoe: " Philipp Hahn
2026-03-11 9:26 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-10 11:49 ` [PATCH 55/61] interconnect: " Philipp Hahn
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-10 11:49 ` [PATCH 56/61] clk: " Philipp Hahn
2026-03-10 13:21 ` Brian Masney
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-11 2:07 ` Chen-Yu Tsai
2026-03-10 11:49 ` [PATCH 57/61] reset: " Philipp Hahn
2026-03-10 12:43 ` Philipp Zabel
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-11 4:59 ` Masami Hiramatsu (Google)
2026-03-10 11:49 ` [PATCH 58/61] arch/x86: " Philipp Hahn
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-10 11:49 ` [PATCH 59/61] debugobjects: Drop likely() around !IS_ERR_OR_NULL() Philipp Hahn
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-10 11:49 ` [PATCH 60/61] Input alps: Drop unlikely() around IS_ERR_OR_NULL() Philipp Hahn
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-10 11:49 ` [PATCH 61/61] file: " Philipp Hahn
2026-03-10 12:23 ` Jeff Layton
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-10 14:14 ` [PATCH 00/61] treewide: Use IS_ERR_OR_NULL over manual NULL check - refactor Steven Rostedt
2026-03-10 14:23 ` Theodore Tso
2026-03-10 18:40 ` Kuan-Wei Chiu
2026-03-11 21:27 ` Claude review: " Claude Code Review Bot
2026-03-11 0:09 ` Russell King (Oracle)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260310-b4-is_err_or_null-v1-2-bd63b656022d@avm.de \
--to=phahn-oss@avm.de \
--cc=amd-gfx@lists.freedesktop.org \
--cc=apparmor@lists.ubuntu.com \
--cc=bpf@vger.kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=clm@fb.com \
--cc=cocci@inria.fr \
--cc=dm-devel@lists.linux.dev \
--cc=dri-devel@lists.freedesktop.org \
--cc=dsterba@suse.com \
--cc=gfs2@lists.linux.dev \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=iommu@lists.linux.dev \
--cc=kvm@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-modules@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-sctp@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ntfs3@lists.linux.dev \
--cc=samba-technical@lists.samba.org \
--cc=sched-ext@lists.linux.dev \
--cc=target-devel@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=v9fs@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox