summaryrefslogtreecommitdiff
path: root/drivers/iommu
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2023-08-16 11:13:18 +0300
committerJason Gunthorpe <jgg@nvidia.com>2023-08-18 18:56:24 +0300
commiteb501c2d96cfce6b42528e8321ea085ec605e790 (patch)
treee2229a8d39574ac9078d957a9196b13da04471fc /drivers/iommu
parent55243393b06ced5378dcdbb7d51bd8a8edc69294 (diff)
downloadlinux-eb501c2d96cfce6b42528e8321ea085ec605e790.tar.xz
iommufd/selftest: Don't leak the platform device memory when unloading the module
It should call platform_device_unregister() instead of platform_device_del() to unregister and free the device. Fixes: 23a1b46f15d5 ("iommufd/selftest: Make the mock iommu driver into a real driver") Link: https://lore.kernel.org/r/20230816081318.1232865-1-yangyingliang@huawei.com Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/iommufd/selftest.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c
index 90e7c5400282..56506d5753f1 100644
--- a/drivers/iommu/iommufd/selftest.c
+++ b/drivers/iommu/iommufd/selftest.c
@@ -1089,7 +1089,7 @@ err_sysfs:
err_bus:
bus_unregister(&iommufd_mock_bus_type.bus);
err_platform:
- platform_device_del(selftest_iommu_dev);
+ platform_device_unregister(selftest_iommu_dev);
err_dbgfs:
debugfs_remove_recursive(dbgfs_root);
return rc;
@@ -1102,6 +1102,6 @@ void iommufd_test_exit(void)
&iommufd_mock_bus_type.bus,
&iommufd_mock_bus_type.nb);
bus_unregister(&iommufd_mock_bus_type.bus);
- platform_device_del(selftest_iommu_dev);
+ platform_device_unregister(selftest_iommu_dev);
debugfs_remove_recursive(dbgfs_root);
}