All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xarray: fix unused-variable warnings
@ 2018-10-02 21:06 Arnd Bergmann
  0 siblings, 0 replies; only message in thread
From: Arnd Bergmann @ 2018-10-02 21:06 UTC (permalink / raw)
  To: Matthew Wilcox, Arnd Bergmann; +Cc: linux-kernel

Two variables that are only used in an #ifdef cause compiler warnings:

lib/test_xarray.c: In function 'check_xa_tag_1':
lib/test_xarray.c:162:15: error: unused variable 'order' [-Werror=unused-variable]
  unsigned int order;

lib/test_xarray.c: In function 'check_xa_shrink':
lib/test_xarray.c:288:15: error: unused variable 'order' [-Werror=unused-variable]
  unsigned int order;

Add another #ifdef around the declaration to avoid the warning.

Fixes: 4f79afaf4662 ("xarray: Move multiorder_shrink to kernel tests")
Fixes: 137689411a26 ("xarray: Move multiorder account test in-kernel")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 lib/test_xarray.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/test_xarray.c b/lib/test_xarray.c
index ef68a3f0fc4c..1f3674fda53d 100644
--- a/lib/test_xarray.c
+++ b/lib/test_xarray.c
@@ -159,7 +159,9 @@ static noinline void check_xa_load(struct xarray *xa)
 
 static noinline void check_xa_tag_1(struct xarray *xa, unsigned long index)
 {
+#ifdef CONFIG_XARRAY_MULTI
 	unsigned int order;
+#endif
 
 	/* NULL elements have no tags set */
 	XA_BUG_ON(xa, xa_get_mark(xa, index, XA_MARK_0));
@@ -285,7 +287,9 @@ static noinline void check_xa_shrink(struct xarray *xa)
 {
 	XA_STATE(xas, xa, 1);
 	struct xa_node *node;
+#ifdef CONFIG_XARRAY_MULTI
 	unsigned int order;
+#endif
 
 	XA_BUG_ON(xa, !xa_empty(xa));
 	XA_BUG_ON(xa, xa_store_index(xa, 0, GFP_KERNEL) != NULL);
-- 
2.18.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-02 21:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-02 21:06 [PATCH] xarray: fix unused-variable warnings Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.