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>
This commit is contained in:
Hawking Zhang 2019-08-31 14:20:38 +08:00 committed by Alex Deucher
parent 4ce71be67b
commit 8bf2485aec
4 changed files with 7 additions and 4 deletions

View file

@ -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:

View file

@ -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);

View file

@ -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;
}

View file

@ -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: