gfs2: Use IS_ERR_OR_NULL
authorKefeng Wang <wangkefeng.wang@huawei.com>
Wed, 5 Jun 2019 14:24:24 +0000 (22:24 +0800)
committerAndreas Gruenbacher <agruenba@redhat.com>
Thu, 27 Jun 2019 18:53:46 +0000 (20:53 +0200)
Use IS_ERR_OR_NULL where appropriate.

(Several more places converted by Andreas.)

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/dir.c
fs/gfs2/glock.c
fs/gfs2/inode.c
fs/gfs2/ops_fstype.c

index 88e4f955c51835dc613100ad06c08b68fde93be9..6f35d19eec2537aad6c575fa504aa19ad9ee3b3a 100644 (file)
@@ -750,7 +750,7 @@ static struct gfs2_dirent *gfs2_dirent_split_alloc(struct inode *inode,
        struct gfs2_dirent *dent;
        dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size,
                                gfs2_dirent_find_offset, name, ptr);
-       if (!dent || IS_ERR(dent))
+       if (IS_ERR_OR_NULL(dent))
                return dent;
        return do_init_dirent(inode, dent, name, bh,
                              (unsigned)(ptr - (void *)dent));
@@ -854,7 +854,7 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
                return ERR_PTR(error);
        dent = gfs2_dirent_scan(inode, bh->b_data, bh->b_size, scan, name, NULL);
 got_dent:
-       if (unlikely(dent == NULL || IS_ERR(dent))) {
+       if (IS_ERR_OR_NULL(dent)) {
                brelse(bh);
                bh = NULL;
        }
index f1ebcb42cbf56a7fa8ac549b06d46a222c479caa..44718098cc60f1c26fc07d38dde5bac5e0d5ee8b 100644 (file)
@@ -681,7 +681,7 @@ static void delete_work_func(struct work_struct *work)
                goto out;
 
        inode = gfs2_lookup_by_inum(sdp, no_addr, NULL, GFS2_BLKST_UNLINKED);
-       if (inode && !IS_ERR(inode)) {
+       if (!IS_ERR_OR_NULL(inode)) {
                d_prune_aliases(inode);
                iput(inode);
        }
index b296c59832a7810913a7a99300409e63f2bdafdd..2e2a8a2fb51dd6b95e478ad711ace6ac940d9852 100644 (file)
@@ -793,7 +793,7 @@ fail_free_acls:
 fail_gunlock:
        gfs2_dir_no_add(&da);
        gfs2_glock_dq_uninit(ghs);
-       if (inode && !IS_ERR(inode)) {
+       if (!IS_ERR_OR_NULL(inode)) {
                clear_nlink(inode);
                if (!free_vfs_inode)
                        mark_inode_dirty(inode);
index 8d614f599065f77cc888d378825268ff438f02f5..c199d1d813fcd94380bf752a41dd02015348d6fe 100644 (file)
@@ -576,7 +576,7 @@ static int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
 
                INIT_WORK(&jd->jd_work, gfs2_recover_func);
                jd->jd_inode = gfs2_lookupi(sdp->sd_jindex, &name, 1);
-               if (!jd->jd_inode || IS_ERR(jd->jd_inode)) {
+               if (IS_ERR_OR_NULL(jd->jd_inode)) {
                        if (!jd->jd_inode)
                                error = -ENOENT;
                        else