[PATCH 2/2] xfs: Fix compiler warning in xfs_attr_shortform_add

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix compiler warning: variable 'error' set but not used in
xfs_attr_shortform_add

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Signed-off-by: Allison Collins <allison.henderson@xxxxxxxxxx>
---
 fs/xfs/libxfs/xfs_attr.c      |  3 +--
 fs/xfs/libxfs/xfs_attr_leaf.c | 11 ++++++++---
 fs/xfs/libxfs/xfs_attr_leaf.h |  2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index 4ef0020..3428f8b 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -562,8 +562,7 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
 	if (!forkoff)
 		return -ENOSPC;
 
-	xfs_attr_shortform_add(args, forkoff);
-	return 0;
+	return xfs_attr_shortform_add(args, forkoff);
 }
 
 
diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
index ad7b351..d0653bb 100644
--- a/fs/xfs/libxfs/xfs_attr_leaf.c
+++ b/fs/xfs/libxfs/xfs_attr_leaf.c
@@ -708,7 +708,7 @@ xfs_attr_sf_findname(
  * Add a name/value pair to the shortform attribute list.
  * Overflow from the inode has already been checked for.
  */
-void
+int
 xfs_attr_shortform_add(
 	struct xfs_da_args		*args,
 	int				forkoff)
@@ -730,7 +730,8 @@ xfs_attr_shortform_add(
 	ASSERT(ifp->if_flags & XFS_IFINLINE);
 	sf = (xfs_attr_shortform_t *)ifp->if_u1.if_data;
 	error = xfs_attr_sf_findname(args, &sfe, NULL);
-	ASSERT(error != -EEXIST);
+	if (error == -EEXIST)
+		return error;
 
 	offset = (char *)sfe - (char *)sf;
 	size = XFS_ATTR_SF_ENTSIZE_BYNAME(args->namelen, args->valuelen);
@@ -748,6 +749,8 @@ xfs_attr_shortform_add(
 	xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA);
 
 	xfs_sbversion_add_attr2(mp, args->trans);
+
+	return 0;
 }
 
 /*
@@ -1151,7 +1154,9 @@ xfs_attr3_leaf_to_shortform(
 		nargs.valuelen = be16_to_cpu(name_loc->valuelen);
 		nargs.hashval = be32_to_cpu(entry->hashval);
 		nargs.attr_filter = entry->flags & XFS_ATTR_NSP_ONDISK_MASK;
-		xfs_attr_shortform_add(&nargs, forkoff);
+		error = xfs_attr_shortform_add(&nargs, forkoff);
+		if (error)
+			goto out;
 	}
 	error = 0;
 
diff --git a/fs/xfs/libxfs/xfs_attr_leaf.h b/fs/xfs/libxfs/xfs_attr_leaf.h
index 9b1c59f..e0027bb 100644
--- a/fs/xfs/libxfs/xfs_attr_leaf.h
+++ b/fs/xfs/libxfs/xfs_attr_leaf.h
@@ -46,7 +46,7 @@ struct xfs_attr3_icleaf_hdr {
  * Internal routines when attribute fork size < XFS_LITINO(mp).
  */
 void	xfs_attr_shortform_create(struct xfs_da_args *args);
-void	xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
+int	xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
 int	xfs_attr_shortform_lookup(struct xfs_da_args *args);
 int	xfs_attr_shortform_getvalue(struct xfs_da_args *args);
 int	xfs_attr_shortform_to_leaf(struct xfs_da_args *args,
-- 
2.7.4




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux