bpf: Remove useless else if
Subsystems (2)
PATCH 1/1 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).
Reported-by Abaci Robot <[email protected]>
Signed-off-by Jiapeng Chong <[email protected]>
--- kernel/bpf/cgroup_iter.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/bpf/cgroup_iter.c +1 -3
@@ -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; }
Signature · 1 line
2.20.1.7.g153144c
This patch was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <[email protected]>:
Quoted 11 lines · On Wed, 31 Aug 2022 10:16:18 +0800 you wrote:
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).
Reported-by Abaci Robot <[email protected]>Signed-off-by Jiapeng Chong <[email protected]>[...]
Here is the summary with links:
- bpf: Remove useless else if
https://git.kernel.org/bpf/bpf-next/c/ccf365eac0c7
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html