summaryrefslogtreecommitdiff
path: root/kernel/bpf/cgroup_iter.c
diff options
context:
space:
mode:
authorJiapeng Chong <jiapeng.chong@linux.alibaba.com>2022-08-31 05:16:18 +0300
committerMartin KaFai Lau <martin.lau@kernel.org>2022-09-02 00:04:07 +0300
commitccf365eac0c7705591dee0158ae5c198d9e8f858 (patch)
treea816d7b25e4077d4f15df9802d71331efd062941 /kernel/bpf/cgroup_iter.c
parent23d86c8e02e55e511cd37e7ef2280a0030750954 (diff)
downloadlinux-ccf365eac0c7705591dee0158ae5c198d9e8f858.tar.xz
bpf: Remove useless else if
The assignment of the else and else if branches is the same, so the else if here is redundant, so we remove it and add a comment to make the code here readable. ./kernel/bpf/cgroup_iter.c:81:6-8: WARNING: possible condition with no effect (if == else). Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2016 Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Link: https://lore.kernel.org/r/20220831021618.86770-1-jiapeng.chong@linux.alibaba.com Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'kernel/bpf/cgroup_iter.c')
-rw-r--r--kernel/bpf/cgroup_iter.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/kernel/bpf/cgroup_iter.c b/kernel/bpf/cgroup_iter.c
index c69bce2f4403..0d200a993489 100644
--- a/kernel/bpf/cgroup_iter.c
+++ b/kernel/bpf/cgroup_iter.c
@@ -78,9 +78,7 @@ static void *cgroup_iter_seq_start(struct seq_file *seq, loff_t *pos)
return css_next_descendant_pre(NULL, p->start_css);
else if (p->order == BPF_CGROUP_ITER_DESCENDANTS_POST)
return css_next_descendant_post(NULL, p->start_css);
- else if (p->order == BPF_CGROUP_ITER_ANCESTORS_UP)
- return p->start_css;
- else /* BPF_CGROUP_ITER_SELF_ONLY */
+ else /* BPF_CGROUP_ITER_SELF_ONLY and BPF_CGROUP_ITER_ANCESTORS_UP */
return p->start_css;
}