Commit eb501c2d authored by Yang Yingliang's avatar Yang Yingliang Committed by Jason Gunthorpe

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: 23a1b46f ("iommufd/selftest: Make the mock iommu driver into a real driver")
Link: https://lore.kernel.org/r/20230816081318.1232865-1-yangyingliang@huawei.comSigned-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 55243393
...@@ -1089,7 +1089,7 @@ int __init iommufd_test_init(void) ...@@ -1089,7 +1089,7 @@ int __init iommufd_test_init(void)
err_bus: err_bus:
bus_unregister(&iommufd_mock_bus_type.bus); bus_unregister(&iommufd_mock_bus_type.bus);
err_platform: err_platform:
platform_device_del(selftest_iommu_dev); platform_device_unregister(selftest_iommu_dev);
err_dbgfs: err_dbgfs:
debugfs_remove_recursive(dbgfs_root); debugfs_remove_recursive(dbgfs_root);
return rc; return rc;
...@@ -1102,6 +1102,6 @@ void iommufd_test_exit(void) ...@@ -1102,6 +1102,6 @@ void iommufd_test_exit(void)
&iommufd_mock_bus_type.bus, &iommufd_mock_bus_type.bus,
&iommufd_mock_bus_type.nb); &iommufd_mock_bus_type.nb);
bus_unregister(&iommufd_mock_bus_type.bus); bus_unregister(&iommufd_mock_bus_type.bus);
platform_device_del(selftest_iommu_dev); platform_device_unregister(selftest_iommu_dev);
debugfs_remove_recursive(dbgfs_root); debugfs_remove_recursive(dbgfs_root);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment