Skip to contentSkip to conversation

xfs: Fix compiler warnings

PATCH In review Allison Collins 2 participants 5 messages Jul 28, 2020 XFS filesystem

lore
Share & tools
lore
#0 lore raw

v4 cover xfs: Fix compiler warnings

Some variables added in the delayed attr series were only used in ASSERT checks, and caused some compiler warnings. This set fixes these warnings by removing the convenience variable.

Allison Collins (2):
xfs: Fix compiler warning in xfs_attr_node_removename_setup
xfs: Fix compiler warning in xfs_attr_shortform_add

 fs/xfs/libxfs/xfs_attr.c      | 7 +++----
 fs/xfs/libxfs/xfs_attr_leaf.c | 6 +++---
 2 files changed, 6 insertions(+), 7 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v4 1/2 xfs: Fix compiler warning in xfs_attr_node_removename_setup

Fix compiler warning for variable 'blk' set but not used in xfs_attr_node_removename_setup.

---
 fs/xfs/libxfs/xfs_attr.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
fs/xfs/libxfs/xfs_attr.c +3 -4
index d4583a0..e5ec9ed 100644
@@ -1174,15 +1174,14 @@ int xfs_attr_node_removename_setup(
 	struct xfs_da_state	**state)
 {
 	int			error;
-	struct xfs_da_state_blk	*blk;
 
 	error = xfs_attr_node_hasname(args, state);
 	if (error != -EEXIST)
 		return error;
 
-	blk = &(*state)->path.blk[(*state)->path.active - 1];
-	ASSERT(blk->bp != NULL);
-	ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC);
+	ASSERT((*state)->path.blk[(*state)->path.active - 1].bp != NULL);
+	ASSERT((*state)->path.blk[(*state)->path.active - 1].magic ==
+		XFS_ATTR_LEAF_MAGIC);
 
 	if (args->rmtblkno > 0) {
 		error = xfs_attr_leaf_mark_incomplete(args, *state);
Signature · 1 line
2.7.4
Reviewed-by on v4 1/2
#2 lore raw

Re: [PATCH v4 1/2] xfs: Fix compiler warning in xfs_attr_node_removename_setup

Quoted 5 lines · Allison Collins

Fix compiler warning for variable 'blk' set but not used in xfs_attr_node_removename_setup.

Fixes 534c7e150352 ("xfs: Add helper function xfs_attr_node_removename_setup")
Quoted 28 lines
---
 fs/xfs/libxfs/xfs_attr.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
fs/xfs/libxfs/xfs_attr.c +3 -4
index d4583a0..e5ec9ed 100644
@@ -1174,15 +1174,14 @@ int xfs_attr_node_removename_setup(
 	struct xfs_da_state	**state)
 {
 	int			error;
-	struct xfs_da_state_blk	*blk;
 
 	error = xfs_attr_node_hasname(args, state);
 	if (error != -EEXIST)
 		return error;
 
-	blk = &(*state)->path.blk[(*state)->path.active - 1];
-	ASSERT(blk->bp != NULL);
-	ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC);
+	ASSERT((*state)->path.blk[(*state)->path.active - 1].bp != NULL);
+	ASSERT((*state)->path.blk[(*state)->path.active - 1].magic ==
+		XFS_ATTR_LEAF_MAGIC);
 
 	if (args->rmtblkno > 0) {
 		error = xfs_attr_leaf_mark_incomplete(args, *state);
#3 lore raw

PATCH v4 2/2 xfs: Fix compiler warning in xfs_attr_shortform_add

In reply to Allison Collins

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

---
 fs/xfs/libxfs/xfs_attr_leaf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/xfs/libxfs/xfs_attr_leaf.c +3 -3
index ad7b351..8623c81 100644
@@ -715,7 +715,7 @@ xfs_attr_shortform_add(
 {
 	struct xfs_attr_shortform	*sf;
 	struct xfs_attr_sf_entry	*sfe;
-	int				offset, size, error;
+	int				offset, size;
 	struct xfs_mount		*mp;
 	struct xfs_inode		*dp;
 	struct xfs_ifork		*ifp;
@@ -729,8 +729,8 @@ xfs_attr_shortform_add(
 	ifp = dp->i_afp;
 	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 (xfs_attr_sf_findname(args, &sfe, NULL) == -EEXIST)
+		ASSERT(0);
 
 	offset = (char *)sfe - (char *)sf;
 	size = XFS_ATTR_SF_ENTSIZE_BYNAME(args->namelen, args->valuelen);
Signature · 1 line
2.7.4
Reviewed-by on v4 2/2
#4 lore raw

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

Quoted 5 lines · Allison Collins

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

Fixes cfe3d8821c6f ("xfs: Add xfs_has_attr and subroutines")
Quoted 29 lines
---
 fs/xfs/libxfs/xfs_attr_leaf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/xfs/libxfs/xfs_attr_leaf.c +3 -3
index ad7b351..8623c81 100644
@@ -715,7 +715,7 @@ xfs_attr_shortform_add(
 {
 	struct xfs_attr_shortform	*sf;
 	struct xfs_attr_sf_entry	*sfe;
-	int				offset, size, error;
+	int				offset, size;
 	struct xfs_mount		*mp;
 	struct xfs_inode		*dp;
 	struct xfs_ifork		*ifp;
@@ -729,8 +729,8 @@ xfs_attr_shortform_add(
 	ifp = dp->i_afp;
 	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 (xfs_attr_sf_findname(args, &sfe, NULL) == -EEXIST)
+		ASSERT(0);
 
 	offset = (char *)sfe - (char *)sf;
 	size = XFS_ATTR_SF_ENTSIZE_BYNAME(args->namelen, args->valuelen);