From: Tom St Denis Date: Tue, 6 Sep 2016 13:42:55 +0000 (-0400) Subject: drm/amd/amdgpu: Allow calling si_dpm_fini at any point X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=9623e4bfaa5e78727cae5c19b9ee5f94cf6bb24a;p=openwrt%2Fstaging%2Fblogic.git drm/amd/amdgpu: Allow calling si_dpm_fini at any point Allow calling fini even if ps array is not allocated. Signed-off-by: Tom St Denis Reviewed-by: Edward O'Callaghan Reviewed-by: Huang Rui Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c b/drivers/gpu/drm/amd/amdgpu/si_dpm.c index e90bb4423cc7..2a72b2b5801d 100644 --- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c @@ -7519,9 +7519,9 @@ static void si_dpm_fini(struct amdgpu_device *adev) { int i; - for (i = 0; i < adev->pm.dpm.num_ps; i++) { - kfree(adev->pm.dpm.ps[i].ps_priv); - } + if (adev->pm.dpm.ps) + for (i = 0; i < adev->pm.dpm.num_ps; i++) + kfree(adev->pm.dpm.ps[i].ps_priv); kfree(adev->pm.dpm.ps); kfree(adev->pm.dpm.priv); kfree(adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries);