瀏覽代碼

drm/amdgpu: don't allocate zero sized kernel BOs

Just free the BO if the size should be zero.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Christian König 7 年之前
父節點
當前提交
21a7e77f77
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

+ 5 - 0
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

@@ -250,6 +250,11 @@ int amdgpu_bo_create_reserved(struct amdgpu_device *adev,
 	bool free = false;
 	int r;
 
+	if (!size) {
+		amdgpu_bo_unref(bo_ptr);
+		return 0;
+	}
+
 	memset(&bp, 0, sizeof(bp));
 	bp.size = size;
 	bp.byte_align = align;