Skip to contentSkip to conversation

drm/amdgpu: fix error handling in amdgpu_bo_list_create

PATCH In review Christian König 2 participants 3 messages Sep 18, 2019 – Sep 25, 2019 1 message not in the archive

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

PATCH 1/1 drm/amdgpu: fix error handling in amdgpu_bo_list_create

We need to drop normal and userptr BOs separately.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +6 -1
index d497467b7fc6..94908bf269a6 100644
@@ -139,7 +139,12 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp,
 	return 0;
 
 error_free:
-	while (i--) {
+	for (i = 0; i < last_entry; ++i) {
+		struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo);
+
+		amdgpu_bo_unref(&bo);
+	}
+	for (i = first_userptr; i < num_entries; ++i) {
 		struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo);
 
 		amdgpu_bo_unref(&bo);
Signature · 6 lines
2.17.1

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

A message that is not in the archive (sent off-list or not yet received): 20190918174308.107845-1-christian.koenig-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Ping? Can I get at least and acked-by for this?

Thanks,
Christian.

Am 18.09.19 um 19:43 schrieb Christian König:

Quoted 15 lines

We need to drop normal and userptr BOs separately.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +0 -0
index d497467b7fc6..94908bf269a6 100644
@@ -139,7 +139,12 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp,
  	return 0;
 
  error_free:

drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp, · line 150

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +6 -1
-	while (i--) {
+	for (i = 0; i < last_entry; ++i) {
+		struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo);
+
+		amdgpu_bo_unref(&bo);
+	}
+	for (i = first_userptr; i < num_entries; ++i) {
  		struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo);
 
  		amdgpu_bo_unref(&bo);

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

Acked-by Huang Rui
#3 lore raw
In reply to a message not in the archive
Quoted 10 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Christian K?nig
Sent: Thursday, September 19, 2019 1:43 AM
To: [email protected]
Subject: [PATCH] drm/amdgpu: fix error handling in amdgpu_bo_list_create

We need to drop normal and userptr BOs separately.

Quoted 27 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +6 -1
index d497467b7fc6..94908bf269a6 100644
@@ -139,7 +139,12 @@ int amdgpu_bo_list_create(struct amdgpu_device
 *adev, struct drm_file *filp,
 	return 0;
 
 error_free:
-	while (i--) {
+	for (i = 0; i < last_entry; ++i) {
+		struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo);
+
+		amdgpu_bo_unref(&bo);
+	}
+	for (i = first_userptr; i < num_entries; ++i) {
 		struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo);
 

amdgpu_bo_unref(&bo);
--
2.17.1

Quoted 4 lines

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

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