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>
This commit is contained in:
committed by
David S. Miller
parent
cfdf0d9ae7
commit
f79a3bcb1a
@@ -1351,8 +1351,6 @@ static int tca_action_flush(struct net *net, struct nlattr *nla,
|
|||||||
module_put(ops->owner);
|
module_put(ops->owner);
|
||||||
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
|
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
|
||||||
n->nlmsg_flags & NLM_F_ECHO);
|
n->nlmsg_flags & NLM_F_ECHO);
|
||||||
if (err > 0)
|
|
||||||
return 0;
|
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
NL_SET_ERR_MSG(extack, "Failed to send TC action flush notification");
|
NL_SET_ERR_MSG(extack, "Failed to send TC action flush notification");
|
||||||
|
|
||||||
@@ -1423,8 +1421,6 @@ tcf_del_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],
|
|||||||
|
|
||||||
ret = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
|
ret = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
|
||||||
n->nlmsg_flags & NLM_F_ECHO);
|
n->nlmsg_flags & NLM_F_ECHO);
|
||||||
if (ret > 0)
|
|
||||||
return 0;
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1481,7 +1477,6 @@ tcf_add_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],
|
|||||||
u32 portid, size_t attr_size, struct netlink_ext_ack *extack)
|
u32 portid, size_t attr_size, struct netlink_ext_ack *extack)
|
||||||
{
|
{
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
int err = 0;
|
|
||||||
|
|
||||||
skb = alloc_skb(attr_size <= NLMSG_GOODSIZE ? NLMSG_GOODSIZE : attr_size,
|
skb = alloc_skb(attr_size <= NLMSG_GOODSIZE ? NLMSG_GOODSIZE : attr_size,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
@@ -1495,11 +1490,8 @@ tcf_add_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
|
return rtnetlink_send(skb, net, portid, RTNLGRP_TC,
|
||||||
n->nlmsg_flags & NLM_F_ECHO);
|
n->nlmsg_flags & NLM_F_ECHO);
|
||||||
if (err > 0)
|
|
||||||
err = 0;
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tcf_action_add(struct net *net, struct nlattr *nla,
|
static int tcf_action_add(struct net *net, struct nlattr *nla,
|
||||||
|
|||||||
@@ -1870,13 +1870,10 @@ static int tfilter_notify(struct net *net, struct sk_buff *oskb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (unicast)
|
if (unicast)
|
||||||
err = netlink_unicast(net->rtnl, skb, portid, MSG_DONTWAIT);
|
err = rtnl_unicast(skb, net, portid);
|
||||||
else
|
else
|
||||||
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
|
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
|
||||||
n->nlmsg_flags & NLM_F_ECHO);
|
n->nlmsg_flags & NLM_F_ECHO);
|
||||||
|
|
||||||
if (err > 0)
|
|
||||||
err = 0;
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1909,15 +1906,13 @@ static int tfilter_del_notify(struct net *net, struct sk_buff *oskb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (unicast)
|
if (unicast)
|
||||||
err = netlink_unicast(net->rtnl, skb, portid, MSG_DONTWAIT);
|
err = rtnl_unicast(skb, net, portid);
|
||||||
else
|
else
|
||||||
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
|
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
|
||||||
n->nlmsg_flags & NLM_F_ECHO);
|
n->nlmsg_flags & NLM_F_ECHO);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
NL_SET_ERR_MSG(extack, "Failed to send filter delete notification");
|
NL_SET_ERR_MSG(extack, "Failed to send filter delete notification");
|
||||||
|
|
||||||
if (err > 0)
|
|
||||||
err = 0;
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2711,13 +2706,11 @@ static int tc_chain_notify(struct tcf_chain *chain, struct sk_buff *oskb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (unicast)
|
if (unicast)
|
||||||
err = netlink_unicast(net->rtnl, skb, portid, MSG_DONTWAIT);
|
err = rtnl_unicast(skb, net, portid);
|
||||||
else
|
else
|
||||||
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
|
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
|
||||||
flags & NLM_F_ECHO);
|
flags & NLM_F_ECHO);
|
||||||
|
|
||||||
if (err > 0)
|
|
||||||
err = 0;
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2741,7 +2734,7 @@ static int tc_chain_notify_delete(const struct tcf_proto_ops *tmplt_ops,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (unicast)
|
if (unicast)
|
||||||
return netlink_unicast(net->rtnl, skb, portid, MSG_DONTWAIT);
|
return rtnl_unicast(skb, net, portid);
|
||||||
|
|
||||||
return rtnetlink_send(skb, net, portid, RTNLGRP_TC, flags & NLM_F_ECHO);
|
return rtnetlink_send(skb, net, portid, RTNLGRP_TC, flags & NLM_F_ECHO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1845,7 +1845,6 @@ static int tclass_notify(struct net *net, struct sk_buff *oskb,
|
|||||||
{
|
{
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
u32 portid = oskb ? NETLINK_CB(oskb).portid : 0;
|
u32 portid = oskb ? NETLINK_CB(oskb).portid : 0;
|
||||||
int err = 0;
|
|
||||||
|
|
||||||
skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
|
skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
|
||||||
if (!skb)
|
if (!skb)
|
||||||
@@ -1856,11 +1855,8 @@ static int tclass_notify(struct net *net, struct sk_buff *oskb,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
|
return rtnetlink_send(skb, net, portid, RTNLGRP_TC,
|
||||||
n->nlmsg_flags & NLM_F_ECHO);
|
n->nlmsg_flags & NLM_F_ECHO);
|
||||||
if (err > 0)
|
|
||||||
err = 0;
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tclass_del_notify(struct net *net,
|
static int tclass_del_notify(struct net *net,
|
||||||
@@ -1894,8 +1890,6 @@ static int tclass_del_notify(struct net *net,
|
|||||||
|
|
||||||
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
|
err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
|
||||||
n->nlmsg_flags & NLM_F_ECHO);
|
n->nlmsg_flags & NLM_F_ECHO);
|
||||||
if (err > 0)
|
|
||||||
err = 0;
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user