From: Christoph Hellwig Date: Wed, 30 Jun 2021 22:38:58 +0000 (-0400) Subject: xfs: simplify xfs_attr_remove_args X-Git-Tag: v5.13.0-rc0~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7373ad4f30a92a198c6371eeba0003b31782b47b;p=thirdparty%2Fxfsprogs-dev.git xfs: simplify xfs_attr_remove_args Source kernel commit: 605e74e29218bb22edd5ddcf90a4d37df00446cc Directly return from the subfunctions and avoid the error variable. Also remove the not really needed dp local variable. Signed-off-by: Christoph Hellwig Reviewed-by: Brian Foster Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 79c82668f..40384e995 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -386,21 +386,16 @@ int xfs_attr_remove_args( struct xfs_da_args *args) { - struct xfs_inode *dp = args->dp; - int error; + if (!xfs_inode_hasattr(args->dp)) + return -ENOATTR; - if (!xfs_inode_hasattr(dp)) { - error = -ENOATTR; - } else if (dp->i_afp->if_format == XFS_DINODE_FMT_LOCAL) { - ASSERT(dp->i_afp->if_flags & XFS_IFINLINE); - error = xfs_attr_shortform_remove(args); - } else if (xfs_attr_is_leaf(dp)) { - error = xfs_attr_leaf_removename(args); - } else { - error = xfs_attr_node_removename(args); + if (args->dp->i_afp->if_format == XFS_DINODE_FMT_LOCAL) { + ASSERT(args->dp->i_afp->if_flags & XFS_IFINLINE); + return xfs_attr_shortform_remove(args); } - - return error; + if (xfs_attr_is_leaf(args->dp)) + return xfs_attr_leaf_removename(args); + return xfs_attr_node_removename(args); } /*