[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231205-kunit_bus-v1-3-635036d3bc13@google.com>
Date: Tue, 05 Dec 2023 15:31:35 +0800
From: davidgow@...gle.com
To: Rae Moar <rmoar@...gle.com>,
Brendan Higgins <brendan.higgins@...ux.dev>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Matti Vaittinen <mazziesaccount@...il.com>,
Stephen Boyd <sboyd@...nel.org>,
Shuah Khan <skhan@...uxfoundation.org>,
Jonathan Corbet <corbet@....net>,
Kees Cook <keescook@...omium.org>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Maxime Ripard <mripard@...nel.org>
Cc: linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org, linux-sound@...r.kernel.org,
David Gow <davidgow@...gle.com>
Subject: [PATCH 3/4] overflow: Replace fake root_device with kunit_device
Using struct root_device to create fake devices for tests is something
of a hack. The new struct kunit_device is meant for this purpose, so use
it instead.
Signed-off-by: David Gow <davidgow@...gle.com>
---
lib/overflow_kunit.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/overflow_kunit.c b/lib/overflow_kunit.c
index 34db0b3aa502..91b03217c462 100644
--- a/lib/overflow_kunit.c
+++ b/lib/overflow_kunit.c
@@ -7,6 +7,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <kunit/test.h>
+#include <kunit/device.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/mm.h>
@@ -618,7 +619,7 @@ static void overflow_allocation_test(struct kunit *test)
} while (0)
/* Create dummy device for devm_kmalloc()-family tests. */
- dev = root_device_register(device_name);
+ dev = kunit_device_register(test, device_name);
KUNIT_ASSERT_FALSE_MSG(test, IS_ERR(dev),
"Cannot register test device\n");
@@ -634,7 +635,7 @@ static void overflow_allocation_test(struct kunit *test)
check_allocation_overflow(devm_kmalloc);
check_allocation_overflow(devm_kzalloc);
- device_unregister(dev);
+ kunit_device_unregister(test, dev);
kunit_info(test, "%d allocation overflow tests finished\n", count);
#undef check_allocation_overflow
--
2.43.0.rc2.451.g8631bc7472-goog
Powered by blists - more mailing lists