diff options
author | Yafang Shao <laoar.shao@gmail.com> | 2023-10-29 06:14:28 +0000 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2023-11-09 13:25:46 -1000 |
commit | 96a2b48e5e1df6698f504969f0f51dc34e52ff3d (patch) | |
tree | 512b40f7b232745e99b07fb26a4c347ff263b121 | |
parent | a12deb44f9734dc25970c266249b272e44d3d1b5 (diff) | |
download | linux-96a2b48e5e1df6698f504969f0f51dc34e52ff3d.tar.gz linux-96a2b48e5e1df6698f504969f0f51dc34e52ff3d.tar.bz2 linux-96a2b48e5e1df6698f504969f0f51dc34e52ff3d.zip |
cgroup: Remove unnecessary list_empty()
The root hasn't been removed from the root_list, so the list can't be NULL.
However, if it had been removed, attempting to destroy it once more is not
possible. Let's replace this with WARN_ON_ONCE() for clarity.
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r-- | kernel/cgroup/cgroup.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 1d5b9de3b1b9..3a436e4f0da1 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -1347,10 +1347,9 @@ static void cgroup_destroy_root(struct cgroup_root *root) spin_unlock_irq(&css_set_lock); - if (!list_empty(&root->root_list)) { - list_del(&root->root_list); - cgroup_root_count--; - } + WARN_ON_ONCE(list_empty(&root->root_list)); + list_del(&root->root_list); + cgroup_root_count--; if (!have_favordynmods) cgroup_favor_dynmods(root, false); |