xfs: Fix compiler warnings
v3 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 declaring them only when debug is set or 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 | 5 ++++- 2 files changed, 7 insertions(+), 5 deletions(-)
Signature · 1 line
2.7.4
PATCH v3 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
@@ -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
PATCH v3 2/2 xfs: Fix compiler warning in xfs_attr_shortform_add
In reply to Allison CollinsFix compiler warning warning: variable 'error' set but not used in xfs_attr_shortform_add. error is used only in an ASSERT so only declare error when DEBUG is set.
--- fs/xfs/libxfs/xfs_attr_leaf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/xfs/libxfs/xfs_attr_leaf.c +4 -1
@@ -715,7 +715,10 @@ xfs_attr_shortform_add( {struct xfs_attr_shortform *sf;struct xfs_attr_sf_entry *sfe; -int offset, size, error; +int offset, size; +#if DEBUG +int error; +#endif struct xfs_mount *mp;struct xfs_inode *dp;struct xfs_ifork *ifp;
Signature · 1 line
2.7.4
Re: [PATCH v3 2/2] xfs: Fix compiler warning in xfs_attr_shortform_add
Quoted 9 lines · Allison Collins
Fix compiler warning warning: variable 'error' set but not used in
xfs_attr_shortform_add. error is used only in an ASSERT so only declare error when DEBUG is set.Reported-by kernel test robot <[email protected]>Signed-off-by Allison Collins <[email protected]>--- fs/xfs/libxfs/xfs_attr_leaf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
same problem...
you've made the existence of "error" conditional on DEBUG, but then you unconditionally assign to it in the function:
error = xfs_attr_sf_findname(args, &sfe, NULL);
ASSERT(error != -EEXIST);so this won't build.
-Eric
Quoted 17 lines
fs/xfs/libxfs/xfs_attr_leaf.c +4
-1@@ -715,7 +715,10 @@ xfs_attr_shortform_add( {struct xfs_attr_shortform *sf;struct xfs_attr_sf_entry *sfe; -int offset, size, error; +int offset, size; +#if DEBUG +int error; +#endif struct xfs_mount *mp;struct xfs_inode *dp;struct xfs_ifork *ifp;
Re: [PATCH v3 2/2] xfs: Fix compiler warning in xfs_attr_shortform_add
Quoted 13 lines · Eric Sandeen
Quoted 9 lines · Allison Collins
Fix compiler warning warning: variable 'error' set but not used in
xfs_attr_shortform_add. error is used only in an ASSERT so only declare error when DEBUG is set.Reported-by kernel test robot <[email protected]>Signed-off-by Allison Collins <[email protected]>--- fs/xfs/libxfs/xfs_attr_leaf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)same problem...
Quoted 7 lines
you've made the existence of "error" conditional on DEBUG, but then you unconditionally assign to it in the function:
error = xfs_attr_sf_findname(args, &sfe, NULL); ASSERT(error != -EEXIST);so this won't build.
Hmm, should I add some error handling back in then? Maybe just
if (error == -EEXIST) return;
Right after the ASSERT? I think that makes all the compiler configs correct then?
Allison
Quoted 20 lines
-Eric
Quoted 17 lines
fs/xfs/libxfs/xfs_attr_leaf.c +4
-1@@ -715,7 +715,10 @@ xfs_attr_shortform_add( {struct xfs_attr_shortform *sf;struct xfs_attr_sf_entry *sfe; -int offset, size, error; +int offset, size; +#if DEBUG +int error; +#endif struct xfs_mount *mp;struct xfs_inode *dp;struct xfs_ifork *ifp;