]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: clean up state variable usage in xfs_attr_node_remove_attr
authorDarrick J. Wong <djwong@kernel.org>
Wed, 22 Jun 2022 19:28:52 +0000 (14:28 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 22 Jun 2022 19:28:52 +0000 (14:28 -0500)
Source kernel commit: 3768f6985700106e90eca87d814dc08e609a9969

The state variable is now a local variable pointing to a heap
allocation, so we don't need to zero-initialize it, nor do we need the
conditional to decide if we should free it.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_attr.c

index 0190e03c7a3a02d8d8a4206da9426cdad3f9f96b..5ed13aa1530a1d0c5a86a11645c28bb0947be84d 100644 (file)
@@ -1514,7 +1514,7 @@ xfs_attr_node_remove_attr(
        struct xfs_attr_item            *attr)
 {
        struct xfs_da_args              *args = attr->xattri_da_args;
-       struct xfs_da_state             *state = NULL;
+       struct xfs_da_state             *state = xfs_da_state_alloc(args);
        int                             retval = 0;
        int                             error = 0;
 
@@ -1524,8 +1524,6 @@ xfs_attr_node_remove_attr(
         * attribute entry after any split ops.
         */
        args->attr_filter |= XFS_ATTR_INCOMPLETE;
-       state = xfs_da_state_alloc(args);
-       state->inleaf = 0;
        error = xfs_da3_node_lookup_int(state, &retval);
        if (error)
                goto out;
@@ -1543,8 +1541,7 @@ xfs_attr_node_remove_attr(
        retval = error = 0;
 
 out:
-       if (state)
-               xfs_da_state_free(state);
+       xfs_da_state_free(state);
        if (error)
                return error;
        return retval;