[PATCH 05/61] smb: Prefer IS_ERR_OR_NULL over manual NULl check
Philipp Hahn
phahn-oss at avm.de
Tue Mar 10 04:48:31 PDT 2026
Prefer using IS_ERR_OR_NULL() over using IS_ERR() and a manual NULL
check.
Change generated with coccinelle.
To: Steve French <sfrench at samba.org>
To: Paulo Alcantara <pc at manguebit.org>
To: Ronnie Sahlberg <ronniesahlberg at gmail.com>
To: Shyam Prasad N <sprasad at microsoft.com>
To: Tom Talpey <tom at talpey.com>
To: Bharath SM <bharathsm at microsoft.com>
Cc: linux-cifs at vger.kernel.org
Cc: samba-technical at lists.samba.org
Cc: linux-kernel at vger.kernel.org
Signed-off-by: Philipp Hahn <phahn-oss at avm.de>
---
fs/smb/client/cifsglob.h | 2 +-
fs/smb/client/connect.c | 2 +-
fs/smb/client/readdir.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
index 6f9b6c72962b09260542b711d4c64e7dc42c7845..fb731b2609465ebe50742936b458aba210ecbd4a 100644
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -1336,7 +1336,7 @@ void cifs_put_tlink(struct tcon_link *tlink);
static inline struct tcon_link *
cifs_get_tlink(struct tcon_link *tlink)
{
- if (tlink && !IS_ERR(tlink))
+ if (!IS_ERR_OR_NULL(tlink))
atomic_inc(&tlink->tl_count);
return tlink;
}
diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index 3bad2c5c523dbd1d4b1ab253567984612be0f348..aa12d327894b270b59ea30be0e6d77b4188fc98f 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -2895,7 +2895,7 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
void
cifs_put_tlink(struct tcon_link *tlink)
{
- if (!tlink || IS_ERR(tlink))
+ if (IS_ERR_OR_NULL(tlink))
return;
if (!atomic_dec_and_test(&tlink->tl_count) ||
diff --git a/fs/smb/client/readdir.c b/fs/smb/client/readdir.c
index be22bbc4a65a03ec64b87d8505d1496279f22efc..3e9260cca196ea8ab17aad82c4824ec5e468e2e7 100644
--- a/fs/smb/client/readdir.c
+++ b/fs/smb/client/readdir.c
@@ -165,7 +165,7 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
inode = ERR_PTR(-ENOMEM);
alias = d_splice_alias(inode, dentry);
d_lookup_done(dentry);
- if (alias && !IS_ERR(alias))
+ if (!IS_ERR_OR_NULL(alias))
dput(alias);
}
dput(dentry);
--
2.43.0
More information about the Linux-rockchip
mailing list