Commit e2ae32d8 authored by James Zhu's avatar James Zhu Committed by Alex Deucher
Browse files

drm/amdxcp: fix amdxcp unloads incompletely



amdxcp unloads incompletely, and below error will be seen during load/unload,
sysfs: cannot create duplicate filename '/devices/platform/amdgpu_xcp.0'

devres_release_group will free xcp device at first, platform device will be
unregistered later in platform_device_unregister.

Signed-off-by: default avatarJames Zhu <James.Zhu@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f0b8f65b
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -89,9 +89,10 @@ EXPORT_SYMBOL(amdgpu_xcp_drm_dev_alloc);
void amdgpu_xcp_drv_release(void)
{
	for (--pdev_num; pdev_num >= 0; --pdev_num) {
		devres_release_group(&xcp_dev[pdev_num]->pdev->dev, NULL);
		platform_device_unregister(xcp_dev[pdev_num]->pdev);
		xcp_dev[pdev_num]->pdev = NULL;
		struct platform_device *pdev = xcp_dev[pdev_num]->pdev;

		devres_release_group(&pdev->dev, NULL);
		platform_device_unregister(pdev);
		xcp_dev[pdev_num] = NULL;
	}
	pdev_num = 0;