Skip to contentSkip to conversation

drm/amd/pp: Fix logic error in smu7_check_dpm_table_updated

PATCH In review Rex Zhu 2 participants 2 messages Apr 11, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/1 drm/amd/pp: Fix logic error in smu7_check_dpm_table_updated

---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +2 -2
index 68b9e0b..31d271f 100644
@@ -4684,7 +4684,7 @@ static void smu7_check_dpm_table_updated(struct pp_hwmgr *hwmgr)
 	for (i=0; i < dep_table->count; i++) {
 		if (dep_table->entries[i].vddc != odn_dep_table->entries[i].vddc) {
 			data->need_update_smu7_dpm_table |= DPMTABLE_OD_UPDATE_VDDC;
-			break;
+			return;
 		}
 	}
 	if (i == dep_table->count)
@@ -4695,7 +4695,7 @@ static void smu7_check_dpm_table_updated(struct pp_hwmgr *hwmgr)
 	for (i=0; i < dep_table->count; i++) {
 		if (dep_table->entries[i].vddc != odn_dep_table->entries[i].vddc) {
 			data->need_update_smu7_dpm_table |= DPMTABLE_OD_UPDATE_VDDC;
-			break;
+			return;
 		}
 	}
 	if (i == dep_table->count)
Signature · 6 lines
1.9.1

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

A message that is not in the archive (sent off-list or not yet received): 1523448006-21812-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 1 line · Rex Zhu

Is this really worth it? It just saves a few cycles, but I'm worried if we ever extend or rewrite the function we may miss later updates. At the very least, I'd add a comment saying something like "return as soon as we know the VDDC has changed, no need to check for additional VDDC changes"

Alex

Quoted 29 lines
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +2 -3
index 68b9e0b..31d271f 100644
@@ -4684,7 +4684,7 @@ static void smu7_check_dpm_table_updated(struct pp_hwmgr *hwmgr)
        for (i=0; i < dep_table->count; i++) {
                if (dep_table->entries[i].vddc != odn_dep_table->entries[i].vddc) {
                        data->need_update_smu7_dpm_table |= DPMTABLE_OD_UPDATE_VDDC;
-                       break;
+                       return;
                }
        }
        if (i == dep_table->count)
@@ -4695,7 +4695,7 @@ static void smu7_check_dpm_table_updated(struct pp_hwmgr *hwmgr)
        for (i=0; i < dep_table->count; i++) {
                if (dep_table->entries[i].vddc != odn_dep_table->entries[i].vddc) {
                        data->need_update_smu7_dpm_table |= DPMTABLE_OD_UPDATE_VDDC;
-                       break;
+                       return;
                }
        }
        if (i == dep_table->count)
--

1.9.1

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