Skip to contentSkip to conversation

xfs: remove unused variable in xchk_stats_estimate_bufsize()

PATCH Applied Yiqing Wu 3 participants 3 messages Nov 16 – Nov 18 XFS filesystem

lore
Share & tools
lore

Yiqing Wu

author
#0 lore raw

PATCH 1/1 xfs: remove unused variable in xchk_stats_estimate_bufsize()

The css variable in xchk_stats_estimate_bufsize() is initialized to point to the start of the cs_stats array and incremented on every iteration of the scan loop, but it is never dereferenced. GCC flags this as a dead assignment when building with W=1:

fs/xfs/scrub/stats.c:146:34: warning: variable css set but not used [-Wunused-but-set-variable=]

Drop the variable and the loop increment.

---
 fs/xfs/scrub/stats.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/xfs/scrub/stats.c +1 -2
index 6934d76cfd15..dfdac4e7b4ad 100644
@@ -143,7 +143,6 @@ STATIC size_t
 xchk_stats_estimate_bufsize(
 	struct xchk_stats	*cs)
 {
-	struct xchk_scrub_stats	*css = &cs->cs_stats[0];
 	unsigned int		i;
 	size_t			field_width;
 	size_t			ret = 0;
@@ -157,7 +156,7 @@ xchk_stats_estimate_bufsize(
 			      offsetof(struct xchk_scrub_stats, checktime_us)) /
 			     sizeof(uint64_t));
 
-	for (i = 0; i < XFS_SCRUB_TYPE_NR; i++, css++) {
+	for (i = 0; i < XFS_SCRUB_TYPE_NR; i++) {
 		if (!name_map[i])
 			continue;
 
Signature · 1 line
2.56.0
maintainer Applied
#2 lore raw
In reply to Yiqing Wu
Quoted 8 lines · Yiqing Wu

The css variable in xchk_stats_estimate_bufsize() is initialized to point to the start of the cs_stats array and incremented on every iteration of the scan loop, but it is never dereferenced. GCC flags this as a dead assignment when building with W=1:

fs/xfs/scrub/stats.c:146:34: warning: variable css set but not used [-Wunused-but-set-variable=]

[...]

Applied to for-next, thanks!

[1/1] xfs: remove unused variable in xchk_stats_estimate_bufsize()

      commit: 56b3c41b05ae2fc342ac874757d65482322eb360

Best regards,

Signature · 1 line
Carlos Maiolino <[email protected]>