diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-02-19 07:51:35 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-02-19 07:51:35 +0100 |
commit | 07749061b837a1268146dc8a620a522253cea877 (patch) | |
tree | 3708ac3f1a088869daf7e9826bc4b56abfcdac74 /lib/kunit/test.c | |
parent | 5c0941c55e5f681ffb05f395222ac673460bb3d0 (diff) | |
parent | b401b621758e46812da61fa58a67c3fd8d91de0d (diff) | |
download | linux-stable-07749061b837a1268146dc8a620a522253cea877.tar.gz linux-stable-07749061b837a1268146dc8a620a522253cea877.tar.bz2 linux-stable-07749061b837a1268146dc8a620a522253cea877.zip |
Merge 6.8-rc5 into driver-core-next
We need the driver core changes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib/kunit/test.c')
-rw-r--r-- | lib/kunit/test.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/kunit/test.c b/lib/kunit/test.c index f95d2093a0aa..1d1475578515 100644 --- a/lib/kunit/test.c +++ b/lib/kunit/test.c @@ -17,6 +17,7 @@ #include <linux/panic.h> #include <linux/sched/debug.h> #include <linux/sched.h> +#include <linux/mm.h> #include "debugfs.h" #include "device-impl.h" @@ -801,12 +802,19 @@ static void kunit_module_exit(struct module *mod) }; const char *action = kunit_action(); + /* + * Check if the start address is a valid virtual address to detect + * if the module load sequence has failed and the suite set has not + * been initialized and filtered. + */ + if (!suite_set.start || !virt_addr_valid(suite_set.start)) + return; + if (!action) __kunit_test_suites_exit(mod->kunit_suites, mod->num_kunit_suites); - if (suite_set.start) - kunit_free_suite_set(suite_set); + kunit_free_suite_set(suite_set); } static int kunit_module_notify(struct notifier_block *nb, unsigned long val, @@ -816,12 +824,12 @@ static int kunit_module_notify(struct notifier_block *nb, unsigned long val, switch (val) { case MODULE_STATE_LIVE: + kunit_module_init(mod); break; case MODULE_STATE_GOING: kunit_module_exit(mod); break; case MODULE_STATE_COMING: - kunit_module_init(mod); break; case MODULE_STATE_UNFORMED: break; @@ -920,6 +928,9 @@ static void __exit kunit_exit(void) #ifdef CONFIG_MODULES unregister_module_notifier(&kunit_mod_nb); #endif + + kunit_bus_shutdown(); + kunit_debugfs_cleanup(); } module_exit(kunit_exit); |