Re: [PATCH] drm/amdgpu: Return -ENOMEM when there is no memory in 'amdgpu_gfx_mqd_sw_init'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 21, 2023 at 5:22 AM Srinivasan Shanmugam
<srinivasan.shanmugam@xxxxxxx> wrote:
>
> Return -ENOMEM, when there is no sufficient dynamically allocated memory
> to create MQD backup for ring
>
> Cc: Christian König <christian.koenig@xxxxxxx>
> Cc: Alex Deucher <alexander.deucher@xxxxxxx>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@xxxxxxx>

Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index a33d4bc34cee..6639fde5dd5c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -407,8 +407,11 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
>
>                 /* prepare MQD backup */
>                 kiq->mqd_backup = kmalloc(mqd_size, GFP_KERNEL);
> -               if (!kiq->mqd_backup)
> -                               dev_warn(adev->dev, "no memory to create MQD backup for ring %s\n", ring->name);
> +               if (!kiq->mqd_backup) {
> +                       dev_warn(adev->dev,
> +                                "no memory to create MQD backup for ring %s\n", ring->name);
> +                       return -ENOMEM;
> +               }
>         }
>
>         if (adev->asic_type >= CHIP_NAVI10 && amdgpu_async_gfx_ring) {
> @@ -427,8 +430,10 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
>                                 ring->mqd_size = mqd_size;
>                                 /* prepare MQD backup */
>                                 adev->gfx.me.mqd_backup[i] = kmalloc(mqd_size, GFP_KERNEL);
> -                               if (!adev->gfx.me.mqd_backup[i])
> +                               if (!adev->gfx.me.mqd_backup[i]) {
>                                         dev_warn(adev->dev, "no memory to create MQD backup for ring %s\n", ring->name);
> +                                       return -ENOMEM;
> +                               }
>                         }
>                 }
>         }
> --
> 2.25.1
>




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux