[PATCH 01/14] drm/amdgpu: handle bo size 0 in amdgpu_bo_create_kernel_at

Christian König ckoenig.leichtzumerken at gmail.com
Wed Jul 29 08:40:54 UTC 2020


Am 29.07.20 um 00:45 schrieb Alex Deucher:
> Just return early to match other bo_create functions.
>
> Signed-off-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 5ac7b5561475..16a37caa654a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -366,6 +366,11 @@ int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev,
>   	unsigned int i;
>   	int r;
>   
> +	if (!size) {
> +		amdgpu_bo_unref(bo_ptr);
> +		return 0;
> +	}
> +

Maybe we could just check if amdgpu_bo_create_reserved() allocated a BO 
or not since we have the same check there already.

Christian.

>   	offset &= PAGE_MASK;
>   	size = ALIGN(size, PAGE_SIZE);
>   



More information about the amd-gfx mailing list