Commit 40c81b25 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

sched: check negative err value to safe one level of indent

As it is more common, check err for !0. That allows to safe one level of
indentation and makes the code easier to read. Also, make 'next' variable
global in function as it is used twice.
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7215032c
...@@ -214,6 +214,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n) ...@@ -214,6 +214,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n)
struct Qdisc *q; struct Qdisc *q;
struct tcf_proto __rcu **back; struct tcf_proto __rcu **back;
struct tcf_proto __rcu **chain; struct tcf_proto __rcu **chain;
struct tcf_proto *next;
struct tcf_proto *tp; struct tcf_proto *tp;
const struct Qdisc_class_ops *cops; const struct Qdisc_class_ops *cops;
unsigned long cl; unsigned long cl;
...@@ -355,10 +356,8 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n) ...@@ -355,10 +356,8 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n)
if (fh == 0) { if (fh == 0) {
if (n->nlmsg_type == RTM_DELTFILTER && t->tcm_handle == 0) { if (n->nlmsg_type == RTM_DELTFILTER && t->tcm_handle == 0) {
struct tcf_proto *next = rtnl_dereference(tp->next); next = rtnl_dereference(tp->next);
RCU_INIT_POINTER(*back, next); RCU_INIT_POINTER(*back, next);
tfilter_notify(net, skb, n, tp, fh, tfilter_notify(net, skb, n, tp, fh,
RTM_DELTFILTER, false); RTM_DELTFILTER, false);
tcf_proto_destroy(tp, true); tcf_proto_destroy(tp, true);
...@@ -383,16 +382,13 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n) ...@@ -383,16 +382,13 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n)
break; break;
case RTM_DELTFILTER: case RTM_DELTFILTER:
err = tp->ops->delete(tp, fh); err = tp->ops->delete(tp, fh);
if (err == 0) { if (err)
struct tcf_proto *next = rtnl_dereference(tp->next); goto errout;
next = rtnl_dereference(tp->next);
tfilter_notify(net, skb, n, tp, tfilter_notify(net, skb, n, tp, t->tcm_handle,
t->tcm_handle,
RTM_DELTFILTER, false); RTM_DELTFILTER, false);
if (tcf_proto_destroy(tp, false)) if (tcf_proto_destroy(tp, false))
RCU_INIT_POINTER(*back, next); RCU_INIT_POINTER(*back, next);
}
goto errout;
case RTM_GETTFILTER: case RTM_GETTFILTER:
err = tfilter_notify(net, skb, n, tp, fh, err = tfilter_notify(net, skb, n, tp, fh,
RTM_NEWTFILTER, true); RTM_NEWTFILTER, true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment