drm/amd/amdgpu: Avoid fault when allocating an empty buffer object
authorTom St Denis <tom.stdenis@amd.com>
Mon, 17 Sep 2018 18:07:00 +0000 (14:07 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 19 Sep 2018 17:37:04 +0000 (12:37 -0500)
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

index 84d82d5382f95b39934c94dd37098bc9075afa13..c1387efc0c91b8ddc3dfac4d69bc74c5541c14e6 100644 (file)
@@ -348,7 +348,8 @@ int amdgpu_bo_create_kernel(struct amdgpu_device *adev,
        if (r)
                return r;
 
-       amdgpu_bo_unreserve(*bo_ptr);
+       if (*bo_ptr)
+               amdgpu_bo_unreserve(*bo_ptr);
 
        return 0;
 }