AMD-GFX Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] drm/amd/pm: fix error code in smu_set_power_limit()
@ 2021-04-14  5:59 Dan Carpenter
  2021-04-15 16:23 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-04-14  5:59 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Lijo Lazar, David Airlie, Kevin Wang, kernel-janitors, amd-gfx,
	Daniel Vetter, Evan Quan, Christian König, Hawking Zhang

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@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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amd/pm: fix error code in smu_set_power_limit()
  2021-04-14  5:59 [PATCH] drm/amd/pm: fix error code in smu_set_power_limit() Dan Carpenter
@ 2021-04-15 16:23 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2021-04-15 16:23 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Kevin Wang, David Airlie, Lijo Lazar, kernel-janitors,
	amd-gfx list, Daniel Vetter, Alex Deucher, Evan Quan,
	Christian König, Hawking Zhang

Applied.  Thanks!

Alex

On Wed, Apr 14, 2021 at 1:59 AM Dan Carpenter <dan.carpenter@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@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@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-14  5:59 [PATCH] drm/amd/pm: fix error code in smu_set_power_limit() Dan Carpenter
2021-04-15 16:23 ` Alex Deucher

AMD-GFX Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/amd-gfx/0 amd-gfx/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 amd-gfx amd-gfx/ https://lore.kernel.org/amd-gfx \
		amd-gfx@lists.freedesktop.org
	public-inbox-index amd-gfx

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.freedesktop.lists.amd-gfx


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git