[PATCH] [RFC] wimax: remove duplicate entries in wimax_gnl_policy

From: Arnd Bergmann
Date: Wed Jun 08 2016 - 04:31:59 EST


gcc -Wextra warns about duplicate initializations here:

net/wimax/stack.c:408:29: error: initialized field overwritten [-Werror=override-init]
net/wimax/stack.c:408:29: note: (near initialization for 'wimax_gnl_policy[1]')
net/wimax/stack.c:412:28: error: initialized field overwritten [-Werror=override-init]
net/wimax/stack.c:412:28: note: (near initialization for 'wimax_gnl_policy[1]')
net/wimax/stack.c:413:26: error: initialized field overwritten [-Werror=override-init]
net/wimax/stack.c:413:26: note: (near initialization for 'wimax_gnl_policy[1]')

This was introduced by b61a5eea5904 ("wimax: use
genl_register_family_with_ops()"), which consolidated four existing
genl_ops tables into one as a simplification.

I do not understand the reasoning behind that earlier patch, as it seems
to apply the superset of the four policy to all commands. If it was
indeed correct, we can either remove or comment out the duplicate entries
as I do here.

It's also possible that we want a partial revert of the patch that
introduced this, or a broader rework.

Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>

diff --git a/net/wimax/stack.c b/net/wimax/stack.c
index 5db731512014..1c118def3713 100644
--- a/net/wimax/stack.c
+++ b/net/wimax/stack.c
@@ -404,12 +404,12 @@ void wimax_dev_init(struct wimax_dev *wimax_dev)
EXPORT_SYMBOL_GPL(wimax_dev_init);

static const struct nla_policy wimax_gnl_policy[WIMAX_GNL_ATTR_MAX + 1] = {
- [WIMAX_GNL_RESET_IFIDX] = { .type = NLA_U32, },
- [WIMAX_GNL_RFKILL_IFIDX] = { .type = NLA_U32, },
+/* [WIMAX_GNL_RESET_IFIDX] = { .type = NLA_U32, }, */
+/* [WIMAX_GNL_RFKILL_IFIDX] = { .type = NLA_U32, }, */
[WIMAX_GNL_RFKILL_STATE] = {
.type = NLA_U32 /* enum wimax_rf_state */
},
- [WIMAX_GNL_STGET_IFIDX] = { .type = NLA_U32, },
+/* [WIMAX_GNL_STGET_IFIDX] = { .type = NLA_U32, }, */
[WIMAX_GNL_MSG_IFIDX] = { .type = NLA_U32, },
[WIMAX_GNL_MSG_DATA] = {
.type = NLA_UNSPEC, /* libnl doesn't grok BINARY yet */