summaryrefslogtreecommitdiffstats
path: root/drivers/base/test/Makefile
diff options
context:
space:
mode:
authorMaxime Ripard <mripard@kernel.org>2023-07-20 14:45:08 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-12 13:06:16 +0200
commitb4cc44301b9d35e9420cebecc31fb3964e53499a (patch)
tree9956ed2f880ad43a465690b0f37027047b014d2c /drivers/base/test/Makefile
parent06188bc80ccbec0dc2f9e451b53b2e48321acbd3 (diff)
downloadlinux-stable-b4cc44301b9d35e9420cebecc31fb3964e53499a.tar.gz
linux-stable-b4cc44301b9d35e9420cebecc31fb3964e53499a.tar.bz2
linux-stable-b4cc44301b9d35e9420cebecc31fb3964e53499a.zip
drivers: base: Add basic devm tests for platform devices
Platform devices show some inconsistencies with how devm resources are released when the device has been probed and when it hasn't. In particular, we can register device-managed actions no matter if the device has be bound to a driver or not, but devres_release_all() will only be called if it was bound to a driver or if there's no reference held to it anymore. If it wasn't bound to a driver and we still have a reference, devres_release_all() will never get called. This is surprising considering that if the driver isn't bound but doesn't have any reference to it anymore, that function will get called, and if it was bound to a driver but still has references, that function will get called as well. Even if that case is fairly unusual, it can easily lead to memory leaks. The plan is, with the next patch, to make it consistent and enforce that devres_release_all() is called no matter what situation we're in. For now, it just tests for the current behaviour and skips over the inconsistencies. Reviewed-by: David Gow <davidgow@google.com> Signed-off-by: Maxime Ripard <mripard@kernel.org> Link: https://lore.kernel.org/r/20230720-kunit-devm-inconsistencies-test-v3-2-6aa7e074f373@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/test/Makefile')
-rw-r--r--drivers/base/test/Makefile1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/base/test/Makefile b/drivers/base/test/Makefile
index d589ca3fa8fc..e321dfc7e922 100644
--- a/drivers/base/test/Makefile
+++ b/drivers/base/test/Makefile
@@ -2,6 +2,7 @@
obj-$(CONFIG_TEST_ASYNC_DRIVER_PROBE) += test_async_driver_probe.o
obj-$(CONFIG_DM_KUNIT_TEST) += root-device-test.o
+obj-$(CONFIG_DM_KUNIT_TEST) += platform-device-test.o
obj-$(CONFIG_DRIVER_PE_KUNIT_TEST) += property-entry-test.o
CFLAGS_property-entry-test.o += $(DISABLE_STRUCTLEAK_PLUGIN)