diff mbox series

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

Message ID Y3eg9Ml/LmLR3L3C@kili (mailing list archive)
State Accepted
Commit 4e9a61394dc47d651690f4f87398ac5944e02678
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: microchip: sparx5: fix uninitialized variables | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers fail 1 blamed authors not CCed: Steen.Hegelund@microchip.com; 2 maintainers not CCed: linux-arm-kernel@lists.infradead.org Steen.Hegelund@microchip.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 27 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Dan Carpenter Nov. 18, 2022, 3:12 p.m. UTC
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>
---
 drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Nov. 22, 2022, 4:50 a.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 18 Nov 2022 18:12:52 +0300 you wrote:
> 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>
> ---
>  drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)

Here is the summary with links:
  - [net-next] net: microchip: sparx5: fix uninitialized variables
    https://git.kernel.org/netdev/net-next/c/4e9a61394dc4

You are awesome, thank you!
diff mbox series

Patch

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");