Skip to contentSkip to conversation

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

PATCH Applied Dan Carpenter 2 participants 2 messages Apr 14, 2021 – Apr 15, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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

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")
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 -0
index e0eb7ca112e2..c29d8b3131b7 100644
@@ -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;
 	}
 
Signature · 6 lines
2.30.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Applied
#1 lore raw

Applied. Thanks!

Alex

Quoted 24 lines · Dan Carpenter

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")
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 -1
index e0eb7ca112e2..c29d8b3131b7 100644
@@ -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

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx