public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Chandan Babu R <chandanrlinux@gmail.com>
To: linux-xfs@vger.kernel.org
Cc: Chandan Babu R <chandanrlinux@gmail.com>,
	djwong@kernel.org, allison.henderson@oracle.com,
	kernel test robot <lkp@intel.com>
Subject: [PATCH] xfs: Fix 'set but not used' warning in xfs_bmap_compute_alignments()
Date: Wed, 27 Jan 2021 14:35:37 +0530	[thread overview]
Message-ID: <20210127090537.2640164-1-chandanrlinux@gmail.com> (raw)

With both CONFIG_XFS_DEBUG and CONFIG_XFS_WARN disabled, the only reference to
local variable "error" in xfs_bmap_compute_alignments() gets eliminated during
pre-processing stage of the compilation process. This causes the compiler to
generate a "set but not used" warning.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>
---
This patch is applicable on top of current xfs-linux/for-next branch.

 fs/xfs/libxfs/xfs_bmap.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 2cd24bb06040..ba56554e8c05 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -3471,7 +3471,6 @@ xfs_bmap_compute_alignments(
 	struct xfs_mount	*mp = args->mp;
 	xfs_extlen_t		align = 0; /* minimum allocation alignment */
 	int			stripe_align = 0;
-	int			error;
 
 	/* stripe alignment for allocation is determined by mount parameters */
 	if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC))
@@ -3484,10 +3483,10 @@ xfs_bmap_compute_alignments(
 	else if (ap->datatype & XFS_ALLOC_USERDATA)
 		align = xfs_get_extsz_hint(ap->ip);
 	if (align) {
-		error = xfs_bmap_extsize_align(mp, &ap->got, &ap->prev,
-						align, 0, ap->eof, 0, ap->conv,
-						&ap->offset, &ap->length);
-		ASSERT(!error);
+		if (xfs_bmap_extsize_align(mp, &ap->got, &ap->prev,
+			align, 0, ap->eof, 0, ap->conv, &ap->offset,
+			&ap->length))
+			ASSERT(0);
 		ASSERT(ap->length);
 	}
 
-- 
2.29.2


             reply	other threads:[~2021-01-27  9:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-27  9:05 Chandan Babu R [this message]
2021-01-28 15:34 ` [PATCH] xfs: Fix 'set but not used' warning in xfs_bmap_compute_alignments() Brian Foster
2021-01-28 17:44   ` Darrick J. Wong
2021-01-29  7:40     ` Chandan Babu R
     [not found]       ` <20210129124638.GA2660974@bfoster>
2021-01-29 17:08         ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210127090537.2640164-1-chandanrlinux@gmail.com \
    --to=chandanrlinux@gmail.com \
    --cc=allison.henderson@oracle.com \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=lkp@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox