Skip to contentSkip to conversation

drm/amdgpu: Free user pages if kvmalloc_array fails

PATCH In review Philip Yang 3 participants 3 messages Apr 29, 2022

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

PATCH 1/1 drm/amdgpu: Free user pages if kvmalloc_array fails

To cleanup the BOs of bo_list which have got user pages.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -1
index 44dcbef80229..ccde951244f5 100644
@@ -543,7 +543,8 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 					GFP_KERNEL | __GFP_ZERO);
 		if (!e->user_pages) {
 			DRM_ERROR("kvmalloc_array failure\n");
-			return -ENOMEM;
+			r = -ENOMEM;
+			goto out_free_user_pages;
 		}
 
 		r = amdgpu_ttm_tt_get_user_pages(bo, e->user_pages);
Signature · 1 line
2.35.1
Reviewed-by on v1 1/1
#1 lore raw

Am 29.04.22 um 02:29 schrieb Philip Yang:

Quoted 3 lines

To cleanup the BOs of bo_list which have got user pages.

Quoted 18 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -1
index 44dcbef80229..ccde951244f5 100644
@@ -543,7 +543,8 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
  					GFP_KERNEL | __GFP_ZERO);
  		if (!e->user_pages) {
  			DRM_ERROR("kvmalloc_array failure\n");
-			return -ENOMEM;
+			r = -ENOMEM;
+			goto out_free_user_pages;
  		}
 
  		r = amdgpu_ttm_tt_get_user_pages(bo, e->user_pages);
Reviewed-by on v1 1/1
#2 lore raw
In reply to Philip Yang

Am 2022-04-28 um 20:29 schrieb Philip Yang:

Quoted 3 lines

To cleanup the BOs of bo_list which have got user pages.

Thanks,
  Felix

Quoted 18 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -1
index 44dcbef80229..ccde951244f5 100644
@@ -543,7 +543,8 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
  					GFP_KERNEL | __GFP_ZERO);
  		if (!e->user_pages) {
  			DRM_ERROR("kvmalloc_array failure\n");
-			return -ENOMEM;
+			r = -ENOMEM;
+			goto out_free_user_pages;
  		}
 
  		r = amdgpu_ttm_tt_get_user_pages(bo, e->user_pages);