Re: [PATCH v2] drivers/amd/pm: check the return value of amdgpu_bo_kmap

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

 



On Sat, Sep 24, 2022 at 6:20 PM Li Zhong <floridsleeves@xxxxxxxxx> wrote:
>
> amdgpu_bo_kmap() returns error when fails to map buffer object. Add the
> error check and propagate the error.
>
> Signed-off-by: Li Zhong <floridsleeves@xxxxxxxxx>
> ---
>
> v2: revise the compile error

Applied.  Thanks!

>
>  drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c       | 5 ++++-
>  drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 5 ++++-
>  2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c b/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c
> index 8fd0782a2b20..f5e08b60f66e 100644
> --- a/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c
> +++ b/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c
> @@ -1384,13 +1384,16 @@ static int kv_dpm_enable(struct amdgpu_device *adev)
>  static void kv_dpm_disable(struct amdgpu_device *adev)
>  {
>         struct kv_power_info *pi = kv_get_pi(adev);
> +       int err;
>
>         amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq,
>                        AMDGPU_THERMAL_IRQ_LOW_TO_HIGH);
>         amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq,
>                        AMDGPU_THERMAL_IRQ_HIGH_TO_LOW);
>
> -       amdgpu_kv_smc_bapm_enable(adev, false);
> +       err = amdgpu_kv_smc_bapm_enable(adev, false);
> +       if (err)
> +               DRM_ERROR("amdgpu_kv_smc_bapm_enable failed\n");
>
>         if (adev->asic_type == CHIP_MULLINS)
>                 kv_enable_nb_dpm(adev, false);
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
> index 1eb4e613b27a..ec055858eb95 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
> +++ b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
> @@ -1485,6 +1485,7 @@ static int pp_get_prv_buffer_details(void *handle, void **addr, size_t *size)
>  {
>         struct pp_hwmgr *hwmgr = handle;
>         struct amdgpu_device *adev = hwmgr->adev;
> +       int err;
>
>         if (!addr || !size)
>                 return -EINVAL;
> @@ -1492,7 +1493,9 @@ static int pp_get_prv_buffer_details(void *handle, void **addr, size_t *size)
>         *addr = NULL;
>         *size = 0;
>         if (adev->pm.smu_prv_buffer) {
> -               amdgpu_bo_kmap(adev->pm.smu_prv_buffer, addr);
> +               err = amdgpu_bo_kmap(adev->pm.smu_prv_buffer, addr);
> +               if (err)
> +                       return err;
>                 *size = adev->pm.smu_prv_buffer_size;
>         }
>
> --
> 2.25.1
>



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux