[PATCH] drm/amd/pm: fix error code in smu_set_power_limit()

Alex Deucher alexdeucher at gmail.com
Thu Apr 15 16:23:35 UTC 2021


Applied.  Thanks!

Alex

On Wed, Apr 14, 2021 at 1:59 AM Dan Carpenter <dan.carpenter at oracle.com> wrote:
>
> We should return -EINVAL instead of success if the "limit" is too high.
>
> Fixes: e098bc9612c2 ("drm/amd/pm: optimize the power related source code layout")
> Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
> ---
>  drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> index e0eb7ca112e2..c29d8b3131b7 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> @@ -2221,6 +2221,7 @@ static int smu_set_power_limit(void *handle, uint32_t limit)
>                 dev_err(smu->adev->dev,
>                         "New power limit (%d) is over the max allowed %d\n",
>                         limit, smu->max_power_limit);
> +               ret = -EINVAL;
>                 goto out;
>         }
>
> --
> 2.30.2
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list