kcsan: test: Defer kcsan_test_init() after kunit initialization
authorMarco Elver <elver@google.com>
Mon, 9 Aug 2021 11:25:09 +0000 (13:25 +0200)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 13 Sep 2021 23:41:19 +0000 (16:41 -0700)
commite80704272f5c3f80d315144b5eeaf867082c94ad
tree1806302e7ea4a2bbe09a687f8bf7fb943a0bd27b
parent6880fa6c56601bb8ed59df6c30fd390cc5f6dd8f
kcsan: test: Defer kcsan_test_init() after kunit initialization

When the test is built into the kernel (not a module), kcsan_test_init()
and kunit_init() both use late_initcall(), which means kcsan_test_init()
might see a NULL debugfs_rootdir as parent dentry, resulting in
kcsan_test_init() and kcsan_debugfs_init() both trying to create a
debugfs node named "kcsan" in debugfs root. One of them will show an
error and be unsuccessful.

Defer kcsan_test_init() until we're sure kunit was initialized.

Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/kcsan/kcsan_test.c