summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2018-09-14 21:03:37 +0200
committerAlex Deucher <alexander.deucher@amd.com>2018-09-19 12:36:50 -0500
commit21a7e77f77b348e73c9c67064a545e724c4a0c9a (patch)
tree8f5abf217468e2c199c5bc0c1d3d25f064c1769a /drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
parent3b2de69944cfac8bc8f43c81aeadcbefc31ed48e (diff)
downloadlwn-21a7e77f77b348e73c9c67064a545e724c4a0c9a.tar.gz
lwn-21a7e77f77b348e73c9c67064a545e724c4a0c9a.zip
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>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_object.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index e6909252aefa..84d82d5382f9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/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;