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

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

 





On 7/27/20 2:58 PM, Eric Sandeen wrote:
On 7/27/20 1:06 PM, Allison Collins wrote:
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 <lkp@xxxxxxxxx>
Signed-off-by: Allison Collins <allison.henderson@xxxxxxxxxx>
---
  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.
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

-Eric

diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
index ad7b351..db985b8 100644
--- a/fs/xfs/libxfs/xfs_attr_leaf.c
+++ b/fs/xfs/libxfs/xfs_attr_leaf.c
@@ -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;




[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