diff mbox series

[net-next] net: bareudp: fix duplicate checks of data[] expressions

Message ID 20211028182453.9713-2-sakiwit@gmail.com (mailing list archive)
State Accepted
Commit 5bd663212f2e455f87368cc3a51bee72411499f4
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: bareudp: fix duplicate checks of data[] expressions | expand

Checks

Context Check Description
netdev/cover_letter success Single patches do not need cover letters
netdev/fixes_present success Fixes tag not required for -next series
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 3 of 3 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 3 this patch: 3
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success No Fixes tag
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 13 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 3 this patch: 3
netdev/header_inline success No static functions without inline keyword in header files

Commit Message

Jεan Sacren Oct. 28, 2021, 6:24 p.m. UTC
From: Jean Sacren <sakiwit@gmail.com>

Both !data[IFLA_BAREUDP_PORT] and !data[IFLA_BAREUDP_ETHERTYPE] are
checked.  We should remove the checks of data[IFLA_BAREUDP_PORT] and
data[IFLA_BAREUDP_ETHERTYPE] that follow since they are always true.

Put both statements together in group and balance the space on both
sides of '=' sign.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
---
 drivers/net/bareudp.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Oct. 29, 2021, 12:50 p.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 28 Oct 2021 12:24:53 -0600 you wrote:
> From: Jean Sacren <sakiwit@gmail.com>
> 
> Both !data[IFLA_BAREUDP_PORT] and !data[IFLA_BAREUDP_ETHERTYPE] are
> checked.  We should remove the checks of data[IFLA_BAREUDP_PORT] and
> data[IFLA_BAREUDP_ETHERTYPE] that follow since they are always true.
> 
> Put both statements together in group and balance the space on both
> sides of '=' sign.
> 
> [...]

Here is the summary with links:
  - [net-next] net: bareudp: fix duplicate checks of data[] expressions
    https://git.kernel.org/netdev/net-next/c/5bd663212f2e

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c
index 54e321a695ce..edffc3489a12 100644
--- a/drivers/net/bareudp.c
+++ b/drivers/net/bareudp.c
@@ -577,11 +577,8 @@  static int bareudp2info(struct nlattr *data[], struct bareudp_conf *conf,
 		return -EINVAL;
 	}
 
-	if (data[IFLA_BAREUDP_PORT])
-		conf->port =  nla_get_u16(data[IFLA_BAREUDP_PORT]);
-
-	if (data[IFLA_BAREUDP_ETHERTYPE])
-		conf->ethertype =  nla_get_u16(data[IFLA_BAREUDP_ETHERTYPE]);
+	conf->port = nla_get_u16(data[IFLA_BAREUDP_PORT]);
+	conf->ethertype = nla_get_u16(data[IFLA_BAREUDP_ETHERTYPE]);
 
 	if (data[IFLA_BAREUDP_SRCPORT_MIN])
 		conf->sport_min =  nla_get_u16(data[IFLA_BAREUDP_SRCPORT_MIN]);