]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: remove unneeded return value check for *init_cursor()
authorJoseph Qi <joseph.qi@linux.alibaba.com>
Thu, 7 Jan 2021 20:59:17 +0000 (15:59 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Thu, 7 Jan 2021 20:59:17 +0000 (15:59 -0500)
Source kernel commit: 2e984badbcc0f1cf284441c566ca4309fe59ac05

Since *init_cursor() can always return a valid cursor, the NULL check
in caller is unneeded. So clean them up.
This also keeps the behavior consistent with other callers.

Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_bmap_btree.c
libxfs/xfs_ialloc_btree.c
libxfs/xfs_refcount.c
libxfs/xfs_rmap.c

index 1ec9f5ffbfe665f311710a1604f3ec5c7b1faa24..a1413980c9999a219f0090a2403dc32a47685d0c 100644 (file)
@@ -637,8 +637,6 @@ xfs_bmbt_change_owner(
        ASSERT(XFS_IFORK_PTR(ip, whichfork)->if_format == XFS_DINODE_FMT_BTREE);
 
        cur = xfs_bmbt_init_cursor(ip->i_mount, tp, ip, whichfork);
-       if (!cur)
-               return -ENOMEM;
        cur->bc_ino.flags |= XFS_BTCUR_BMBT_INVALID_OWNER;
 
        error = xfs_btree_change_owner(cur, new_owner, buffer_list);
index 9534171518201541f037aeffa9667a1bd8b648f6..3f0512b2f00f4821cb1f16f1c8e7f197e2398b9e 100644 (file)
@@ -671,11 +671,6 @@ xfs_inobt_cur(
                return error;
 
        cur = xfs_inobt_init_cursor(mp, tp, *agi_bpp, agno, which);
-       if (!cur) {
-               xfs_trans_brelse(tp, *agi_bpp);
-               *agi_bpp = NULL;
-               return -ENOMEM;
-       }
        *curpp = cur;
        return 0;
 }
index 723c903eae8811b46bd593ab49efac87ee85820e..2097e0eae954f9366f127bfddf4b0a7f9dc30333 100644 (file)
@@ -1178,10 +1178,6 @@ xfs_refcount_finish_one(
                        return error;
 
                rcur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno);
-               if (!rcur) {
-                       error = -ENOMEM;
-                       goto out_cur;
-               }
                rcur->bc_ag.refc.nr_ops = nr_ops;
                rcur->bc_ag.refc.shape_changes = shape_changes;
        }
@@ -1216,11 +1212,6 @@ xfs_refcount_finish_one(
                trace_xfs_refcount_finish_one_leftover(mp, agno, type,
                                bno, blockcount, new_agbno, *new_len);
        return error;
-
-out_cur:
-       xfs_trans_brelse(tp, agbp);
-
-       return error;
 }
 
 /*
index 6205b8ed484d34c1cbfe9638fcb1796d0e1fd445..263ef27bce4dfed61c58b0e7985f0eb96ade2eb1 100644 (file)
@@ -2403,10 +2403,6 @@ xfs_rmap_finish_one(
                        return -EFSCORRUPTED;
 
                rcur = xfs_rmapbt_init_cursor(mp, tp, agbp, agno);
-               if (!rcur) {
-                       error = -ENOMEM;
-                       goto out_cur;
-               }
        }
        *pcur = rcur;
 
@@ -2445,11 +2441,6 @@ xfs_rmap_finish_one(
                error = -EFSCORRUPTED;
        }
        return error;
-
-out_cur:
-       xfs_trans_brelse(tp, agbp);
-
-       return error;
 }
 
 /*