Skip to contentSkip to conversation

gpu: drm: swsmu: fix error return code of smu_v11_0_set_allowed_mask()

PATCH Applied Jia-Ju Bai 3 participants 3 messages Mar 5, 2021 – Mar 8, 2021

Subsystems (3)
lore
Share & tools
lore

Jia-Ju Bai

author
#0 lore raw

PATCH 1/1 gpu: drm: 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.

---
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +3 -1
index 90585461a56e..82731a932308 100644
@@ -747,8 +747,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);
 
Signature · 1 line
2.17.1
#1 lore raw

[AMD Public Use]

Thanks. Reviewed-by: Evan Quan <[email protected]>

-----Original Message-----
From: Jia-Ju Bai <[email protected]>
Sent: Friday, March 5, 2021 11:54 AM
To: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]; [email protected]; Quan, Evan <[email protected]>; Zhang, Hawking <[email protected]>; Wang, Kevin(Yang) <[email protected]>; Gao, Likun <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Jia-Ju Bai <[email protected]>
Subject: [PATCH] gpu: drm: 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.

---
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +3 -1
index 90585461a56e..82731a932308 100644
@@ -747,8 +747,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);
 

--
2.17.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Applied
#2 lore raw

Applied. Thanks!

Alex

Quoted 38 lines · Evan

[AMD Public Use]

Thanks. Reviewed-by: Evan Quan <[email protected]>

-----Original Message-----
From: Jia-Ju Bai <[email protected]>
Sent: Friday, March 5, 2021 11:54 AM
To: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]; [email protected]; Quan, Evan <[email protected]>; Zhang, Hawking <[email protected]>; Wang, Kevin(Yang) <[email protected]>; Gao, Likun <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Jia-Ju Bai <[email protected]>
Subject: [PATCH] gpu: drm: 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.

---
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +3 -2
index 90585461a56e..82731a932308 100644
@@ -747,8 +747,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);
 
--
Quoted 5 lines

2.17.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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