Skip to contentSkip to conversation

drm/amd/powerplay: avoid access before allocation

PATCH In review Evan Quan 2 participants 3 messages Jul 12, 2019 – Jul 16, 2019 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/1 drm/amd/powerplay: avoid access before allocation

No access before allocation.

Change-Id Ia1d78786f2400cd1cd227d1ab6ea4c6a71619e4c
---
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +7 -4
index 9e3e737926aa..c70262e6e250 100644
@@ -441,7 +441,6 @@ static int vega20_store_powerplay_table(struct smu_context *smu)
 {
 	ATOM_Vega20_POWERPLAYTABLE *powerplay_table = NULL;
 	struct smu_table_context *table_context = &smu->smu_table;
-	int ret;
 
 	if (!table_context->power_play_table)
 		return -EINVAL;
@@ -455,9 +454,7 @@ static int vega20_store_powerplay_table(struct smu_context *smu)
 	table_context->thermal_controller_type = powerplay_table->ucThermalControllerType;
 	table_context->TDPODLimit = le32_to_cpu(powerplay_table->OverDrive8Table.ODSettingsMax[ATOM_VEGA20_ODSETTING_POWERPERCENTAGE]);
 
-	ret = vega20_setup_od8_information(smu);
-
-	return ret;
+	return 0;
 }
 
 static int vega20_append_powerplay_table(struct smu_context *smu)
@@ -1507,6 +1504,12 @@ static int vega20_set_default_od8_setttings(struct smu_context *smu)
 
 	smu->od_settings = (void *)od8_settings;
 
+	ret = vega20_setup_od8_information(smu);
+	if (ret) {
+		pr_err("Retrieve board OD limits failed!\n");
+		return ret;
+	}
+
 	if (smu_feature_is_enabled(smu, SMU_FEATURE_DPM_SOCCLK_BIT)) {
 		if (od8_settings->od_feature_capabilities[ATOM_VEGA20_ODFEATURE_GFXCLK_LIMITS] &&
 		    od8_settings->od_settings_max[OD8_SETTING_GFXCLK_FMAX] > 0 &&
Signature · 6 lines
2.21.0

_______________________________________________
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): [email protected]

author
#2 lore raw

Ping..

Quoted 57 lines

-----Original Message-----
From: Evan Quan <[email protected]>
Sent: Friday, July 12, 2019 10:55 AM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/powerplay: avoid access before allocation

No access before allocation.

Change-Id Ia1d78786f2400cd1cd227d1ab6ea4c6a71619e4c
---
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -1
index 9e3e737926aa..c70262e6e250 100644
@@ -441,7 +441,6 @@ static int vega20_store_powerplay_table(struct
 smu_context *smu)  {
 	ATOM_Vega20_POWERPLAYTABLE *powerplay_table = NULL;
 	struct smu_table_context *table_context = &smu->smu_table;
-	int ret;
 
 	if (!table_context->power_play_table)
 		return -EINVAL;
@@ -455,9 +454,7 @@ static int vega20_store_powerplay_table(struct
 smu_context *smu)
 	table_context->thermal_controller_type = powerplay_table-
 >ucThermalControllerType;
 	table_context->TDPODLimit = le32_to_cpu(powerplay_table-
Quoted 1 line

OverDrive8Table.ODSettingsMax[ATOM_VEGA20_ODSETTING_POWERPER

CENTAGE]);

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +1 -3
-	ret = vega20_setup_od8_information(smu);
-
-	return ret;
+	return 0;
 }
 
 static int vega20_append_powerplay_table(struct smu_context *smu) @@ -

1507,6 +1504,12 @@ static int vega20_set_default_od8_setttings(struct smu_context *smu)

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +6 -0
 	smu->od_settings = (void *)od8_settings;
 
+	ret = vega20_setup_od8_information(smu);
+	if (ret) {
+		pr_err("Retrieve board OD limits failed!\n");
+		return ret;
+	}
+
 	if (smu_feature_is_enabled(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {
if (od8_settings-

Quoted 5 lines
Quoted 1 line

od_feature_capabilities[ATOM_VEGA20_ODFEATURE_GFXCLK_LIMITS] &&

od8_settings-

Quoted 1 line

od_settings_max[OD8_SETTING_GFXCLK_FMAX] > 0 &&

--
2.21.0

_______________________________________________
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): MN2PR12MB334419B332848A4DE7AE5F67E4CE0-rweVpJHSKToDMgCC8P//[email protected]

Reviewed-by Feifei Xu
#4 lore raw

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Quan, Evan
Sent: Tuesday, July 16, 2019 1:12 PM
To: Quan, Evan <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amd/powerplay: avoid access before allocation

Ping..

Quoted 57 lines

-----Original Message-----
From: Evan Quan <[email protected]>
Sent: Friday, July 12, 2019 10:55 AM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/powerplay: avoid access before allocation

No access before allocation.

Change-Id Ia1d78786f2400cd1cd227d1ab6ea4c6a71619e4c
---
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +0 -1
index 9e3e737926aa..c70262e6e250 100644
@@ -441,7 +441,6 @@ static int vega20_store_powerplay_table(struct
 smu_context *smu)  {
 	ATOM_Vega20_POWERPLAYTABLE *powerplay_table = NULL;
 	struct smu_table_context *table_context = &smu->smu_table;
-	int ret;
 
 	if (!table_context->power_play_table)
 		return -EINVAL;
@@ -455,9 +454,7 @@ static int vega20_store_powerplay_table(struct
 smu_context *smu)
 	table_context->thermal_controller_type = powerplay_table-
 >ucThermalControllerType;
 	table_context->TDPODLimit = le32_to_cpu(powerplay_table-
Quoted 1 line

OverDrive8Table.ODSettingsMax[ATOM_VEGA20_ODSETTING_POWERPER

CENTAGE]);

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +1 -3
-	ret = vega20_setup_od8_information(smu);
-
-	return ret;
+	return 0;
 }
 
 static int vega20_append_powerplay_table(struct smu_context *smu) @@ -

1507,6 +1504,12 @@ static int vega20_set_default_od8_setttings(struct smu_context *smu)

drivers/gpu/drm/amd/powerplay/vega20_ppt.c +6 -0
 	smu->od_settings = (void *)od8_settings;
 
+	ret = vega20_setup_od8_information(smu);
+	if (ret) {
+		pr_err("Retrieve board OD limits failed!\n");
+		return ret;
+	}
+
 	if (smu_feature_is_enabled(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {
if (od8_settings-

Quoted 5 lines
Quoted 1 line

od_feature_capabilities[ATOM_VEGA20_ODFEATURE_GFXCLK_LIMITS] &&

od8_settings-

Quoted 1 line

od_settings_max[OD8_SETTING_GFXCLK_FMAX] > 0 &&

--
2.21.0

_______________________________________________
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