[PATCH 18/34] lib: checksum: hide unused expected_csum_ipv6_magic[]

From: Arnd Bergmann
Date: Wed Apr 03 2024 - 04:20:16 EST


From: Arnd Bergmann <arnd@xxxxxxxx>

When CONFIG_NET is disabled, an extra warning shows up for this
unused variable:

lib/checksum_kunit.c:218:18: error: 'expected_csum_ipv6_magic' defined but not used [-Werror=unused-const-variable=]

Hide it under the same #ifdef as the reference to it.

Fixes: f24a70106dc1 ("lib: checksum: Fix build with CONFIG_NET=n")
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
---
lib/checksum_kunit.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/lib/checksum_kunit.c b/lib/checksum_kunit.c
index bf70850035c7..80dd1e1b71ba 100644
--- a/lib/checksum_kunit.c
+++ b/lib/checksum_kunit.c
@@ -215,6 +215,7 @@ static const u32 init_sums_no_overflow[] = {
0xffff0000, 0xfffffffb,
};

+#ifdef CONFIG_NET
static const u16 expected_csum_ipv6_magic[] = {
0x18d4, 0x3085, 0x2e4b, 0xd9f4, 0xbdc8, 0x78f, 0x1034, 0x8422, 0x6fc0,
0xd2f6, 0xbeb5, 0x9d3, 0x7e2a, 0x312e, 0x778e, 0xc1bb, 0x7cf2, 0x9d1e,
@@ -240,6 +241,7 @@ static const u16 expected_csum_ipv6_magic[] = {
0x99aa, 0xb06b, 0xee19, 0xcc2c, 0xf34c, 0x7c49, 0xdac3, 0xa71e, 0xc988,
0x3845, 0x1014
};
+#endif

static const u16 expected_fast_csum[] = {
0xda83, 0x45da, 0x4f46, 0x4e4f, 0x34e, 0xe902, 0xa5e9, 0x87a5, 0x7187,
--
2.39.2