diff options
author | Michal Kubecek <mkubecek@suse.cz> | 2021-07-08 23:52:40 +0200 |
---|---|---|
committer | Michal Kubecek <mkubecek@suse.cz> | 2021-07-09 00:06:49 +0200 |
commit | 601ea409cb54485bfead833454e8a828d850a8bb (patch) | |
tree | 19b2c04f41fb242fb473d0b92c24aceaeaa77c12 | |
parent | 4c8f9e3092162822e40607cafe4e9768fb621b5b (diff) | |
download | ethtool-601ea409cb54485bfead833454e8a828d850a8bb.tar.gz |
netlink: work around spurious selftest failure
Using a global variable, guaranteed to be zero initialized, for parser
results in netlink/module-eeprom.c works fine for ethtool itself but it
results in a selftest (make check) failure because test-cmdline calls
nl_getmodule() multiple times and parsed values from previous calls
are not cleared.
Rather than clearing the structure manually before each parser run, make
getmodule_cmd_params a local variable of nl_getmodule() as it is not used
anywhere else and this way is more consistent with rest of the netlink
code.
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
-rw-r--r-- | netlink/module-eeprom.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/netlink/module-eeprom.c b/netlink/module-eeprom.c index 355d1de..38e7d2c 100644 --- a/netlink/module-eeprom.c +++ b/netlink/module-eeprom.c @@ -22,8 +22,7 @@ #define ETH_I2C_ADDRESS_HIGH 0x51 #define ETH_I2C_MAX_ADDRESS 0x7F -static struct cmd_params -{ +struct cmd_params { u8 dump_hex; u8 dump_raw; u32 offset; @@ -31,7 +30,7 @@ static struct cmd_params u32 page; u32 bank; u32 i2c_address; -} getmodule_cmd_params; +}; static const struct param_parser getmodule_params[] = { { @@ -342,6 +341,7 @@ static void decoder_print(void) int nl_getmodule(struct cmd_context *ctx) { + struct cmd_params getmodule_cmd_params = {}; struct ethtool_module_eeprom request = {0}; struct ethtool_module_eeprom *reply_page; struct nl_context *nlctx = ctx->nlctx; |