[PATCH 5/7] drm/amdgpu: don't allocate zero sized kernel BOs

Alex Deucher alexdeucher at gmail.com
Fri Sep 14 20:16:37 UTC 2018


On Fri, Sep 14, 2018 at 3:12 PM Christian König
<ckoenig.leichtzumerken at gmail.com> wrote:
>
> Just free the BO if the size is should be zero.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index e1f32a196f6d..d282e923d1b4 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;
> --
> 2.14.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list