The corresponding pointer has been checked at the early stage of each function. Change-Id: Id8e264b4ba3734f91a33b6f0f408884453ea74fa Signed-off-by: Guchun Chen <guchun.chen@xxxxxxx> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c index 50c13b02d234..253511c0419d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c @@ -1173,7 +1173,7 @@ static int amdgpu_ras_badpages_read(struct amdgpu_device *adev, mutex_lock(&con->recovery_lock); data = con->eh_data; - if (!data || data->count == 0) { + if (data->count == 0) { *bps = NULL; goto out; } @@ -1318,8 +1318,6 @@ int amdgpu_ras_add_bad_pages(struct amdgpu_device *adev, mutex_lock(&con->recovery_lock); data = con->eh_data; - if (!data) - goto out; if (data->space_left <= pages) if (amdgpu_ras_realloc_eh_data_space(adev, data, pages)) { @@ -1351,8 +1349,7 @@ int amdgpu_ras_reserve_bad_pages(struct amdgpu_device *adev) mutex_lock(&con->recovery_lock); data = con->eh_data; - if (!data) - goto out; + /* reserve vram at driver post stage. */ for (i = data->last_reserved; i < data->count; i++) { bp = data->bps[i].bp; @@ -1364,7 +1361,7 @@ int amdgpu_ras_reserve_bad_pages(struct amdgpu_device *adev) data->bps[i].bo = bo; data->last_reserved = i + 1; } -out: + mutex_unlock(&con->recovery_lock); return 0; } @@ -1382,8 +1379,6 @@ static int amdgpu_ras_release_bad_pages(struct amdgpu_device *adev) mutex_lock(&con->recovery_lock); data = con->eh_data; - if (!data) - goto out; for (i = data->last_reserved - 1; i >= 0; i--) { bo = data->bps[i].bo; @@ -1393,7 +1388,7 @@ static int amdgpu_ras_release_bad_pages(struct amdgpu_device *adev) data->bps[i].bo = bo; data->last_reserved = i; } -out: + mutex_unlock(&con->recovery_lock); return 0; } -- 2.17.1 _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx