Skip to contentSkip to conversation

drm/amdgpu/swsmu/navi1x: Remove unnecessary conversion to bool

PATCH Superseded Jiapeng Chong 2 participants 2 messages Feb 19, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu/swsmu/navi1x: Remove unnecessary conversion to bool

Fix the following coccicheck warnings:

./drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c:900:47-52: WARNING:
conversion to bool not needed here.

---
 drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -1
index cd7efa9..dc9ce86 100644
@@ -897,7 +897,7 @@ static bool navi10_is_support_fine_grained_dpm(struct smu_context *smu, enum smu
 	dpm_desc = &pptable->DpmDescriptor[clk_index];
 
 	/* 0 - Fine grained DPM, 1 - Discrete DPM */
-	return dpm_desc->SnapToDiscrete == 0 ? true : false;
+	return !(dpm_desc->SnapToDiscrete == 0);
 }
 
 static inline bool navi10_od_feature_is_supported(struct smu_11_0_overdrive_table *od_table, enum SMU_11_0_ODFEATURE_CAP cap)
Signature · 6 lines
1.8.3.1

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

[AMD Official Use Only - Internal Distribution Only]

Hi Jiapeng,

         /* 0 - Fine grained DPM, 1 - Discrete DPM */

- return dpm_desc->SnapToDiscrete == 0 ? true : false;
+ return !(dpm_desc->SnapToDiscrete == 0);

the code logic is wrong, the '!' is not needed.

Best Regards,
Kevin
________________________________
From: dri-devel <[email protected]> on behalf of Jiapeng Chong <[email protected]>
Sent: Friday, February 19, 2021 6:23 PM
To: Deucher, Alexander <[email protected]>
Cc: Jiapeng Chong <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>; Koenig, Christian <[email protected]>
Subject: [PATCH] drm/amdgpu/swsmu/navi1x: Remove unnecessary conversion to bool

Fix the following coccicheck warnings:

./drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c:900:47-52: WARNING:
conversion to bool not needed here.

---
 drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -1
index cd7efa9..dc9ce86 100644
@@ -897,7 +897,7 @@ static bool navi10_is_support_fine_grained_dpm(struct smu_context *smu, enum smu
         dpm_desc = &pptable->DpmDescriptor[clk_index];
 
         /* 0 - Fine grained DPM, 1 - Discrete DPM */
-       return dpm_desc->SnapToDiscrete == 0 ? true : false;
+       return !(dpm_desc->SnapToDiscrete == 0);
 }
 
 static inline bool navi10_od_feature_is_supported(struct smu_11_0_overdrive_table *od_table, enum SMU_11_0_ODFEATURE_CAP cap)

--
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&amp;data=04%7C01%7CKevin1.Wang%40amd.com%7C1709e8c3e5c44eb4d06b08d8d4c067d9%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637493270133033509%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=tX8xq%2B31iYrBp3lLN7KKOBP3k8lMpecaX0ZSZf7c6y4%3D&amp;reserved=0

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