Skip to contentSkip to conversation

xarray: fix unused-variable warnings

PATCH New Arnd Bergmann 1 participant 1 message Oct 2, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xarray: fix unused-variable warnings

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")
---
 lib/test_xarray.c | 4 ++++
 1 file changed, 4 insertions(+)
lib/test_xarray.c +4 -0
index ef68a3f0fc4c..1f3674fda53d 100644
@@ -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);
Signature · 1 line
2.18.0