Skip to content

Commit

Permalink
net: sched: act_bpf: simplify code logic in tcf_bpf_init()
Browse files Browse the repository at this point in the history
Both is_bpf and is_ebpf are boolean types, so
(!is_bpf && !is_ebpf) || (is_bpf && is_ebpf) can be reduced to
is_bpf == is_ebpf in tcf_bpf_init().

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Zhengchao Shao authored and David S. Miller committed Sep 28, 2022
1 parent 6a1dc68 commit 8fff09e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/sched/act_bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ static int tcf_bpf_init(struct net *net, struct nlattr *nla,
is_bpf = tb[TCA_ACT_BPF_OPS_LEN] && tb[TCA_ACT_BPF_OPS];
is_ebpf = tb[TCA_ACT_BPF_FD];

if ((!is_bpf && !is_ebpf) || (is_bpf && is_ebpf)) {
if (is_bpf == is_ebpf) {
ret = -EINVAL;
goto put_chain;
}
Expand Down

0 comments on commit 8fff09e

Please sign in to comment.