Skip to content

Commit f79a3bc

Browse files
Yajun Dengdavem330
authored andcommitted
net/sched: Remove unnecessary if statement
It has been deal with the 'if (err' statement in rtnetlink_send() and rtnl_unicast(). so remove unnecessary if statement. v2: use the raw name rtnetlink_send(). Signed-off-by: Yajun Deng <yajun.deng@linux.dev> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent cfdf0d9 commit f79a3bc

File tree

3 files changed

+8
-29
lines changed

3 files changed

+8
-29
lines changed

net/sched/act_api.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,8 +1351,6 @@ static int tca_action_flush(struct net *net, struct nlattr *nla,
13511351
module_put(ops->owner);
13521352
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
13531353
n->nlmsg_flags & NLM_F_ECHO);
1354-
if (err > 0)
1355-
return 0;
13561354
if (err < 0)
13571355
NL_SET_ERR_MSG(extack, "Failed to send TC action flush notification");
13581356

@@ -1423,8 +1421,6 @@ tcf_del_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],
14231421

14241422
ret = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
14251423
n->nlmsg_flags & NLM_F_ECHO);
1426-
if (ret > 0)
1427-
return 0;
14281424
return ret;
14291425
}
14301426

@@ -1481,7 +1477,6 @@ tcf_add_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],
14811477
u32 portid, size_t attr_size, struct netlink_ext_ack *extack)
14821478
{
14831479
struct sk_buff *skb;
1484-
int err = 0;
14851480

14861481
skb = alloc_skb(attr_size <= NLMSG_GOODSIZE ? NLMSG_GOODSIZE : attr_size,
14871482
GFP_KERNEL);
@@ -1495,11 +1490,8 @@ tcf_add_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],
14951490
return -EINVAL;
14961491
}
14971492

1498-
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
1499-
n->nlmsg_flags & NLM_F_ECHO);
1500-
if (err > 0)
1501-
err = 0;
1502-
return err;
1493+
return rtnetlink_send(skb, net, portid, RTNLGRP_TC,
1494+
n->nlmsg_flags & NLM_F_ECHO);
15031495
}
15041496

15051497
static int tcf_action_add(struct net *net, struct nlattr *nla,

net/sched/cls_api.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,13 +1870,10 @@ static int tfilter_notify(struct net *net, struct sk_buff *oskb,
18701870
}
18711871

18721872
if (unicast)
1873-
err = netlink_unicast(net->rtnl, skb, portid, MSG_DONTWAIT);
1873+
err = rtnl_unicast(skb, net, portid);
18741874
else
18751875
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
18761876
n->nlmsg_flags & NLM_F_ECHO);
1877-
1878-
if (err > 0)
1879-
err = 0;
18801877
return err;
18811878
}
18821879

@@ -1909,15 +1906,13 @@ static int tfilter_del_notify(struct net *net, struct sk_buff *oskb,
19091906
}
19101907

19111908
if (unicast)
1912-
err = netlink_unicast(net->rtnl, skb, portid, MSG_DONTWAIT);
1909+
err = rtnl_unicast(skb, net, portid);
19131910
else
19141911
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
19151912
n->nlmsg_flags & NLM_F_ECHO);
19161913
if (err < 0)
19171914
NL_SET_ERR_MSG(extack, "Failed to send filter delete notification");
19181915

1919-
if (err > 0)
1920-
err = 0;
19211916
return err;
19221917
}
19231918

@@ -2711,13 +2706,11 @@ static int tc_chain_notify(struct tcf_chain *chain, struct sk_buff *oskb,
27112706
}
27122707

27132708
if (unicast)
2714-
err = netlink_unicast(net->rtnl, skb, portid, MSG_DONTWAIT);
2709+
err = rtnl_unicast(skb, net, portid);
27152710
else
27162711
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
27172712
flags & NLM_F_ECHO);
27182713

2719-
if (err > 0)
2720-
err = 0;
27212714
return err;
27222715
}
27232716

@@ -2741,7 +2734,7 @@ static int tc_chain_notify_delete(const struct tcf_proto_ops *tmplt_ops,
27412734
}
27422735

27432736
if (unicast)
2744-
return netlink_unicast(net->rtnl, skb, portid, MSG_DONTWAIT);
2737+
return rtnl_unicast(skb, net, portid);
27452738

27462739
return rtnetlink_send(skb, net, portid, RTNLGRP_TC, flags & NLM_F_ECHO);
27472740
}

net/sched/sch_api.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,6 @@ static int tclass_notify(struct net *net, struct sk_buff *oskb,
18451845
{
18461846
struct sk_buff *skb;
18471847
u32 portid = oskb ? NETLINK_CB(oskb).portid : 0;
1848-
int err = 0;
18491848

18501849
skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
18511850
if (!skb)
@@ -1856,11 +1855,8 @@ static int tclass_notify(struct net *net, struct sk_buff *oskb,
18561855
return -EINVAL;
18571856
}
18581857

1859-
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
1860-
n->nlmsg_flags & NLM_F_ECHO);
1861-
if (err > 0)
1862-
err = 0;
1863-
return err;
1858+
return rtnetlink_send(skb, net, portid, RTNLGRP_TC,
1859+
n->nlmsg_flags & NLM_F_ECHO);
18641860
}
18651861

18661862
static int tclass_del_notify(struct net *net,
@@ -1894,8 +1890,6 @@ static int tclass_del_notify(struct net *net,
18941890

18951891
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
18961892
n->nlmsg_flags & NLM_F_ECHO);
1897-
if (err > 0)
1898-
err = 0;
18991893
return err;
19001894
}
19011895

0 commit comments

Comments
 (0)