diff options
author | Dan Carpenter <error27@gmail.com> | 2022-11-18 18:12:52 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-11-21 20:44:04 -0800 |
commit | 4e9a61394dc47d651690f4f87398ac5944e02678 (patch) | |
tree | 4f3f62b8699fc56c0690842f8dd457d3c7b3f659 /drivers/net/ethernet | |
parent | 32634819ad37290b5d5a84bf8b71ef5e972c4a20 (diff) | |
download | linux-4e9a61394dc47d651690f4f87398ac5944e02678.tar.bz2 |
net: microchip: sparx5: fix uninitialized variables
Smatch complains that "err" can be uninitialized on these paths. Also
it's just nicer to "return 0;" instead of "return err;"
Fixes: 3a344f99bb55 ("net: microchip: sparx5: Add support for TC flower ARP dissector")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/Y3eg9Ml/LmLR3L3C@kili
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c index 04fc2f3b1979..bd6bd380ba34 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c @@ -341,7 +341,7 @@ sparx5_tc_flower_handler_vlan_usage(struct sparx5_tc_flower_parse_usage *st) st->used_keys |= BIT(FLOW_DISSECTOR_KEY_VLAN); - return err; + return 0; out: NL_SET_ERR_MSG_MOD(st->fco->common.extack, "vlan parse error"); return err; @@ -452,8 +452,10 @@ sparx5_tc_flower_handler_arp_usage(struct sparx5_tc_flower_parse_usage *st) /* The IS2 ARP keyset does not support ARP hardware addresses */ if (!is_zero_ether_addr(mt.mask->sha) || - !is_zero_ether_addr(mt.mask->tha)) + !is_zero_ether_addr(mt.mask->tha)) { + err = -EINVAL; goto out; + } if (mt.mask->sip) { ipval = be32_to_cpu((__force __be32)mt.key->sip); @@ -477,7 +479,7 @@ sparx5_tc_flower_handler_arp_usage(struct sparx5_tc_flower_parse_usage *st) st->used_keys |= BIT(FLOW_DISSECTOR_KEY_ARP); - return err; + return 0; out: NL_SET_ERR_MSG_MOD(st->fco->common.extack, "arp parse error"); |