]> www.infradead.org Git - users/jedix/linux-maple.git/commit
srcu: Replace WARN_ON_ONCE() with BUILD_BUG_ON() if possible
authorZhen Lei <thunder.leizhen@huawei.com>
Thu, 22 Aug 2024 03:21:28 +0000 (11:21 +0800)
committerFrederic Weisbecker <frederic@kernel.org>
Wed, 23 Oct 2024 16:01:36 +0000 (18:01 +0200)
commit79a20a857009f12ab28c716d3ba218cf3ceee6f7
tree0c62eebff2641419cfd95b3cac96789ae787db58
parentf7345ccc62a4b880cf76458db5f320725f28e400
srcu: Replace WARN_ON_ONCE() with BUILD_BUG_ON() if possible

The value of ARRAY_SIZE() can be determined at compile time, so if both
sides of the equation are ARRAY_SIZE(), using BUILD_BUG_ON() can help us
catch the problem earlier.

While there are cases where unequal array sizes will work, there is no
point in allowing them, so it makes more sense to force them to be equal
using BUILD_BUG_ON().

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Neeraj Upadhyay <neeraj.upadhyay@kernel.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
kernel/rcu/srcutree.c