Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Jiapeng Chong and committed by
Martin KaFai Lau
ccf365ea 23d86c8e

+1 -3
+1 -3
kernel/bpf/cgroup_iter.c
··· 78 78 return css_next_descendant_pre(NULL, p->start_css); 79 79 else if (p->order == BPF_CGROUP_ITER_DESCENDANTS_POST) 80 80 return css_next_descendant_post(NULL, p->start_css); 81 - else if (p->order == BPF_CGROUP_ITER_ANCESTORS_UP) 82 - return p->start_css; 83 - else /* BPF_CGROUP_ITER_SELF_ONLY */ 81 + else /* BPF_CGROUP_ITER_SELF_ONLY and BPF_CGROUP_ITER_ANCESTORS_UP */ 84 82 return p->start_css; 85 83 } 86 84