Skip to content

Commit

Permalink
iommufd/selftest: Don't leak the platform device memory when unloadin…
Browse files Browse the repository at this point in the history
…g the module

It should call platform_device_unregister() instead of
platform_device_del() to unregister and free the device.

Fixes: 23a1b46 ("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>
  • Loading branch information
Yang Yingliang authored and Jason Gunthorpe committed Aug 18, 2023
1 parent 5524339 commit eb501c2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/iommu/iommufd/selftest.c
Original file line number Diff line number Diff line change
@@ -1089,7 +1089,7 @@ int __init iommufd_test_init(void)
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);
}

0 comments on commit eb501c2

Please sign in to comment.