summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Zhu <James.Zhu@amd.com>2023-09-07 10:41:00 -0400
committerAlex Deucher <alexander.deucher@amd.com>2023-10-26 19:04:53 -0400
commite2ae32d8c2a303af58d22ee61b3b7aa7021e54c9 (patch)
treefb53d3f5aca52c53268d60544cc890763d37b503
parentf0b8f65b482548c9d1d87c20fa4850c61305ff47 (diff)
downloadlinux-stable-e2ae32d8c2a303af58d22ee61b3b7aa7021e54c9.tar.gz
linux-stable-e2ae32d8c2a303af58d22ee61b3b7aa7021e54c9.tar.bz2
linux-stable-e2ae32d8c2a303af58d22ee61b3b7aa7021e54c9.zip
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: James Zhu <James.Zhu@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
index 353597fc908d..90ddd8371176 100644
--- a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
+++ b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
@@ -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;