[PATCH net-next] net: microchip: sparx5: fix uninitialized variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c | 8 +++++---
 1 file 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 a48baeacc1d2..aab7507cf568 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");
-- 
2.35.1




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux