[PATCH] xarray: fix unused-variable warnings
From: Arnd Bergmann
Date: Tue Oct 02 2018 - 17:06:40 EST
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@xxxxxxxx>
---
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