diff options
author | Hawking Zhang <Hawking.Zhang@amd.com> | 2019-08-31 09:20:38 +0300 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-09-14 01:36:22 +0300 |
commit | 8bf2485aec63b9a9cc81ad795e1bb7fda19bf33c (patch) | |
tree | 14366b8e2ab896d9f827d210f322afd22b11de03 /drivers/gpu | |
parent | 4ce71be67b08d00729f4d8735e2b76d8b5882d2c (diff) | |
download | linux-8bf2485aec63b9a9cc81ad795e1bb7fda19bf33c.tar.xz |
drm/amdgpu: fix memory leak when ras is not supported on specific ip block
free ras_if if ras is not supported
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 |
4 files changed, 7 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index 351aefcf3151..1bd2f56186f2 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c @@ -4440,7 +4440,8 @@ static int gfx_v9_0_ecc_late_init(void *handle) r = amdgpu_irq_get(adev, &adev->gfx.cp_ecc_error_irq, 0); if (r) goto late_fini; - } + } else + kfree(adev->gfx.ras_if); return 0; late_fini: diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c index 08a47a5785cd..6a61e5c5b2ce 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c @@ -797,7 +797,8 @@ static int gmc_v9_0_ecc_late_init(void *handle) r = amdgpu_irq_get(adev, &adev->gmc.ecc_irq, 0); if (r) goto umc_late_fini; - } + } else + kfree(adev->gmc.umc_ras_if); if (adev->mmhub_funcs && adev->mmhub_funcs->ras_late_init) { r = adev->mmhub_funcs->ras_late_init(adev); diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c index af15f4b8e3ad..ab6559a2d5e8 100644 --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c @@ -639,7 +639,7 @@ static int mmhub_v1_0_ras_late_init(struct amdgpu_device *adev) mmhub_ih_info.head = mmhub_fs_info.head = *adev->gmc.mmhub_ras_if; r = amdgpu_ras_late_init(adev, adev->gmc.mmhub_ras_if, &mmhub_fs_info, &mmhub_ih_info); - if (r) + if (r || !amdgpu_ras_is_supported(adev, adev->gmc.mmhub_ras_if->block)) kfree(adev->gmc.mmhub_ras_if); return r; } diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c index 82980efd3ee6..4830382ab8f2 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c @@ -1728,7 +1728,8 @@ static int sdma_v4_0_late_init(void *handle) if (r) goto late_fini; } - } + } else + kfree(adev->sdma.ras_if); return 0; late_fini: |