[PATCH 07/10] drm/amd/amdgpu: Deal with possible fail allocation

Christian König christian.koenig at amd.com
Mon Feb 13 21:01:11 UTC 2023


Am 13.02.23 um 21:49 schrieb Arthur Grillo:
> Deal with return value of an allocation. This reduces the number of
> -Wunused-but-set-variable warnings.
>
> Signed-off-by: Arthur Grillo <arthurgrillo at riseup.net>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> index 82e27bd4f038..00c0876840c1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
> @@ -1104,6 +1104,8 @@ int amdgpu_mes_ctx_alloc_meta_data(struct amdgpu_device *adev,
>   			    &ctx_data->meta_data_obj,
>   			    &ctx_data->meta_data_mc_addr,
>   			    &ctx_data->meta_data_ptr);
> +	if (r)
> +		return r;
>   	if (!ctx_data->meta_data_obj)
>   		return -ENOMEM;

That change doesn't make much sense.

We already check ctx_data->meta_data_obj and return -ENOMEM here when 
something goes wrong.

We could potentially remove that, but it's not really a problem as far 
as I can see.

Christian.


More information about the dri-devel mailing list