* [PATCH] bpf: Remove useless else if
@ 2022-08-31 2:16 Jiapeng Chong
2022-09-01 21:10 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2022-08-31 2:16 UTC (permalink / raw)
To: yhs
Cc: ast, daniel, andrii, martin.lau, song, john.fastabend, kpsingh,
sdf, haoluo, jolsa, bpf, linux-kernel, Jiapeng Chong,
Abaci Robot
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>
---
kernel/bpf/cgroup_iter.c | 4 +---
1 file changed, 1 insertion(+), 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;
}
--
2.20.1.7.g153144c
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] bpf: Remove useless else if
2022-08-31 2:16 [PATCH] bpf: Remove useless else if Jiapeng Chong
@ 2022-09-01 21:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-09-01 21:10 UTC (permalink / raw)
To: Jiapeng Chong
Cc: yhs, ast, daniel, andrii, martin.lau, song, john.fastabend,
kpsingh, sdf, haoluo, jolsa, bpf, linux-kernel, abaci
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Martin KaFai Lau <martin.lau@kernel.org>:
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).
>
> 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>
>
> [...]
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-01 21:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-31 2:16 [PATCH] bpf: Remove useless else if Jiapeng Chong
2022-09-01 21:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).