aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJia-Ju Bai <[email protected]>2021-03-04 19:54:28 -0800
committerAlex Deucher <[email protected]>2021-03-23 23:03:18 -0400
commit692bd2a02e2dfe128e8451f9bc1806ab87d0b1d5 (patch)
treef5046ac3404b77e3d610db148ae8a7e02b9f546a
parent554ba183b135ef09250b61a202d88512b5bbd03a (diff)
drm/amdgpu/swsmu: fix error return code of smu_v11_0_set_allowed_mask()
When bitmap_empty() or feature->feature_num triggers an error, no error return code of smu_v11_0_set_allowed_mask() is assigned. To fix this bug, ret is assigned with -EINVAL as error return code. Reviewed-by: Evan Quan <[email protected]> Reported-by: TOTE Robot <[email protected]> Signed-off-by: Jia-Ju Bai <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
-rw-r--r--drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
index 1882a0643f7a..97acb04e1b5a 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
@@ -744,8 +744,10 @@ int smu_v11_0_set_allowed_mask(struct smu_context *smu)
int ret = 0;
uint32_t feature_mask[2];
- if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) || feature->feature_num < 64)
+ if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) || feature->feature_num < 64) {
+ ret = -EINVAL;
goto failed;
+ }
bitmap_copy((unsigned long *)feature_mask, feature->allowed, 64);