Skip to content

Commit

Permalink
net: bareudp: fix duplicate checks of data[] expressions
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jean Sacren authored and David S. Miller committed Oct 29, 2021
1 parent c4cb8d0 commit 5bd6632
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/net/bareudp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 5bd6632

Please sign in to comment.