diff mbox series

[RESEND,1/3] kunit: Make the cases sequence more reasonable for kunit_module_notify()

Message ID 20230928091446.1209703-2-ruanjinjie@huawei.com (mailing list archive)
State New
Delegated to: Brendan Higgins
Headers show
Series kunit: Init and run test suites in the right state | expand

Commit Message

Jinjie Ruan Sept. 28, 2023, 9:14 a.m. UTC
The module has a normal sequence from MODULE_STATE_COMING to
MODULE_STATE_LIVE and to MODULE_STATE_GOING, and eventually
MODULE_STATE_UNFORMED. The original order of cases is confusing
and misleading.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 lib/kunit/test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/lib/kunit/test.c b/lib/kunit/test.c
index 421f13981412..29a5f5ea8112 100644
--- a/lib/kunit/test.c
+++ b/lib/kunit/test.c
@@ -783,14 +783,14 @@  static int kunit_module_notify(struct notifier_block *nb, unsigned long val,
 	struct module *mod = data;
 
 	switch (val) {
+	case MODULE_STATE_COMING:
+		kunit_module_init(mod);
+		break;
 	case MODULE_STATE_LIVE:
 		break;
 	case MODULE_STATE_GOING:
 		kunit_module_exit(mod);
 		break;
-	case MODULE_STATE_COMING:
-		kunit_module_init(mod);
-		break;
 	case MODULE_STATE_UNFORMED:
 		break;
 	}