Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1609349 > unrolled thread
| Started by | Nicholas Mc Guire <der.herr@hofr.at> |
|---|---|
| First post | 2017-03-26 18:30 +0200 |
| Last post | 2017-04-05 08:00 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] cgroup: switch to BUG_ON() Nicholas Mc Guire <der.herr@hofr.at> - 2017-03-26 18:30 +0200
Re: [PATCH] cgroup: switch to BUG_ON() Tejun Heo <tj@kernel.org> - 2017-03-27 20:10 +0200
Re: [PATCH] cgroup: switch to BUG_ON() Zefan Li <lizefan@huawei.com> - 2017-04-05 08:00 +0200
| From | Nicholas Mc Guire <der.herr@hofr.at> |
|---|---|
| Date | 2017-03-26 18:30 +0200 |
| Subject | [PATCH] cgroup: switch to BUG_ON() |
| Message-ID | <tpjdf-2pI-1@gated-at.bofh.it> |
Use BUG_ON() rather than an explicit if followed by BUG() for
improved readability and also consistency.
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---
Found by coccinelle: bugon.cocci
./kernel/cgroup/cpuset.c:2125:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG.
./kernel/cgroup/cpuset.c:2127:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG.
./kernel/cgroup/cpuset.c:2143:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG.
BUG_ON() wraps the explicit if condition and is actually in use for
all conditional BUG() cases in cpuset.c except in this one function.
Patch was compile-tested with: x86_64_defconfig (implies CONFIG_CPUSETS=y)
(checkpatch warnings for this patch seem to be false-positives - the
BUG_ON should be fine)
Patch is against 4.11-rc3 (localversion-next is next-20170324)
kernel/cgroup/cpuset.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 0f41292..8b84db2 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2121,10 +2121,8 @@ int __init cpuset_init(void)
{
int err = 0;
- if (!alloc_cpumask_var(&top_cpuset.cpus_allowed, GFP_KERNEL))
- BUG();
- if (!alloc_cpumask_var(&top_cpuset.effective_cpus, GFP_KERNEL))
- BUG();
+ BUG_ON(!alloc_cpumask_var(&top_cpuset.cpus_allowed, GFP_KERNEL));
+ BUG_ON(!alloc_cpumask_var(&top_cpuset.effective_cpus, GFP_KERNEL));
cpumask_setall(top_cpuset.cpus_allowed);
nodes_setall(top_cpuset.mems_allowed);
@@ -2139,8 +2137,7 @@ int __init cpuset_init(void)
if (err < 0)
return err;
- if (!alloc_cpumask_var(&cpus_attach, GFP_KERNEL))
- BUG();
+ BUG_ON(!alloc_cpumask_var(&cpus_attach, GFP_KERNEL));
return 0;
}
--
2.1.4
[toc] | [next] | [standalone]
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Date | 2017-03-27 20:10 +0200 |
| Message-ID | <tpHfz-3EZ-1@gated-at.bofh.it> |
| In reply to | #1609349 |
On Sun, Mar 26, 2017 at 06:24:06PM +0200, Nicholas Mc Guire wrote: > Use BUG_ON() rather than an explicit if followed by BUG() for > improved readability and also consistency. > > Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at> Applied to cgroup/for-4.12. Thanks. -- tejun
[toc] | [prev] | [next] | [standalone]
| From | Zefan Li <lizefan@huawei.com> |
|---|---|
| Date | 2017-04-05 08:00 +0200 |
| Message-ID | <tsM94-6Yl-17@gated-at.bofh.it> |
| In reply to | #1609349 |
On 2017/3/27 0:24, Nicholas Mc Guire wrote: > Use BUG_ON() rather than an explicit if followed by BUG() for > improved readability and also consistency. > > Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at> > --- > > Found by coccinelle: bugon.cocci > ./kernel/cgroup/cpuset.c:2125:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. > ./kernel/cgroup/cpuset.c:2127:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. > ./kernel/cgroup/cpuset.c:2143:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. > > BUG_ON() wraps the explicit if condition and is actually in use for > all conditional BUG() cases in cpuset.c except in this one function. > > Patch was compile-tested with: x86_64_defconfig (implies CONFIG_CPUSETS=y) > (checkpatch warnings for this patch seem to be false-positives - the > BUG_ON should be fine) > > Patch is against 4.11-rc3 (localversion-next is next-20170324) > Acked-by: Zefan Li <lizefan@huawei.com>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web