]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amdgpu: don't allocate zero sized kernel BOs
authorChristian König <christian.koenig@amd.com>
Fri, 14 Sep 2018 19:03:37 +0000 (21:03 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 19 Sep 2018 17:36:50 +0000 (12:36 -0500)
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>
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

index e6909252aefabec5594cc92eaa2cc7f5acade34e..84d82d5382f95b39934c94dd37098bc9075afa13 100644 (file)
@@ -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;