Skip to contentSkip to conversation

drm/amdgpu: remove redundant NULL ptr check

PATCH New Guchun Chen 1 participant 1 message Aug 16, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: remove redundant NULL ptr check

The corresponding pointer has been checked at the early stage of each function.

Change-Id Id8e264b4ba3734f91a33b6f0f408884453ea74fa
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +4 -9
index 50c13b02d234..253511c0419d 100644
@@ -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;
 }
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx