Skip to content

Commit

Permalink
Revert "drm/amd/amdgpu: Fix potential ioremap() memory leaks in amdgp…
Browse files Browse the repository at this point in the history
…u_device_init()"

commit 03c6284 upstream.

This patch causes the following iounmap erorr and calltrace
iounmap: bad address 00000000d0b3631f

The original patch was unjustified because amdgpu_device_fini_sw() will
always cleanup the rmmio mapping.

This reverts commit eb4f139.

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Suggested-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Ma Jun authored and gregkh committed Apr 13, 2024
1 parent 91fb03c commit 14ac934
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
Expand Up @@ -3639,10 +3639,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
* early on during init and before calling to RREG32.
*/
adev->reset_domain = amdgpu_reset_create_reset_domain(SINGLE_DEVICE, "amdgpu-reset-dev");
if (!adev->reset_domain) {
r = -ENOMEM;
goto unmap_memory;
}
if (!adev->reset_domain)
return -ENOMEM;

/* detect hw virtualization here */
amdgpu_detect_virtualization(adev);
Expand All @@ -3652,20 +3650,20 @@ int amdgpu_device_init(struct amdgpu_device *adev,
r = amdgpu_device_get_job_timeout_settings(adev);
if (r) {
dev_err(adev->dev, "invalid lockup_timeout parameter syntax\n");
goto unmap_memory;
return r;
}

/* early init functions */
r = amdgpu_device_ip_early_init(adev);
if (r)
goto unmap_memory;
return r;

amdgpu_device_set_mcbp(adev);

/* Get rid of things like offb */
r = drm_aperture_remove_conflicting_pci_framebuffers(adev->pdev, &amdgpu_kms_driver);
if (r)
goto unmap_memory;
return r;

/* Enable TMZ based on IP_VERSION */
amdgpu_gmc_tmz_set(adev);
Expand All @@ -3675,7 +3673,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
if (adev->gmc.xgmi.supported) {
r = adev->gfxhub.funcs->get_xgmi_info(adev);
if (r)
goto unmap_memory;
return r;
}

/* enable PCIE atomic ops */
Expand Down Expand Up @@ -3932,8 +3930,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
failed:
amdgpu_vf_error_trans_all(adev);

unmap_memory:
iounmap(adev->rmmio);
return r;
}

Expand Down

0 comments on commit 14ac934

Please sign in to comment.