Skip to content

Commit 57ceb86

Browse files
asbjornstdavem330
authored andcommitted
net: l2tp: cleanup: remove redundant condition
These assignments follow this pattern: unsigned int foo:1; struct nlattr *nla = info->attrs[bar]; if (nla) foo = nla_get_flag(nla); /* expands to: foo = !!nla */ This could be simplified to: if (nla) foo = 1; but lets just remove the condition and use the macro, foo = nla_get_flag(nla); Signed-off-by: Asbjoern Sloth Toennesen <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 97b7af0 commit 57ceb86

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

net/l2tp/l2tp_netlink.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,14 @@ static int l2tp_nl_cmd_tunnel_create(struct sk_buff *skb, struct genl_info *info
220220
cfg.local_udp_port = nla_get_u16(info->attrs[L2TP_ATTR_UDP_SPORT]);
221221
if (info->attrs[L2TP_ATTR_UDP_DPORT])
222222
cfg.peer_udp_port = nla_get_u16(info->attrs[L2TP_ATTR_UDP_DPORT]);
223-
if (info->attrs[L2TP_ATTR_UDP_CSUM])
224-
cfg.use_udp_checksums = nla_get_flag(info->attrs[L2TP_ATTR_UDP_CSUM]);
223+
cfg.use_udp_checksums = nla_get_flag(
224+
info->attrs[L2TP_ATTR_UDP_CSUM]);
225225

226226
#if IS_ENABLED(CONFIG_IPV6)
227-
if (info->attrs[L2TP_ATTR_UDP_ZERO_CSUM6_TX])
228-
cfg.udp6_zero_tx_checksums = nla_get_flag(info->attrs[L2TP_ATTR_UDP_ZERO_CSUM6_TX]);
229-
if (info->attrs[L2TP_ATTR_UDP_ZERO_CSUM6_RX])
230-
cfg.udp6_zero_rx_checksums = nla_get_flag(info->attrs[L2TP_ATTR_UDP_ZERO_CSUM6_RX]);
227+
cfg.udp6_zero_tx_checksums = nla_get_flag(
228+
info->attrs[L2TP_ATTR_UDP_ZERO_CSUM6_TX]);
229+
cfg.udp6_zero_rx_checksums = nla_get_flag(
230+
info->attrs[L2TP_ATTR_UDP_ZERO_CSUM6_RX]);
231231
#endif
232232
}
233233

0 commit comments

Comments
 (0)