diff mbox series

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

Message ID 20230213204923.111948-8-arthurgrillo@riseup.net (mailing list archive)
State New, archived
Headers show
Series Resolve warnings from AMDGPU | expand

Commit Message

Arthur Grillo Feb. 13, 2023, 8:49 p.m. UTC
Deal with return value of an allocation. This reduces the number of
-Wunused-but-set-variable warnings.

Signed-off-by: Arthur Grillo <arthurgrillo@riseup.net>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Christian König Feb. 13, 2023, 9:01 p.m. UTC | #1
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@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.
diff mbox series

Patch

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;