[PATCH] drm/amd/powerplay free driver_pptable for smu reinit

Zhang, Jack (Jian) Jack.Zhang1 at amd.com
Tue Dec 24 05:05:25 UTC 2019



-----Original Message-----
From: Jack Zhang <Jack.Zhang1 at amd.com> 
Sent: Tuesday, December 24, 2019 1:05 PM
To: amd-gfx at lists.freedesktop.org
Cc: Zhang, Jack (Jian) <Jack.Zhang1 at amd.com>
Subject: [PATCH] drm/amd/powerplay free driver_pptable for smu reinit

During gpu recover, smu hw reinit will fail becasue table_context->driver_pptable is not freed and set to NULL.

Free the driver_pptable pointer if it's not NULL.

Signed-off-by: Jack Zhang <Jack.Zhang1 at amd.com>
---
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index 7781d24..ca877bd 100644
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
@@ -713,8 +713,10 @@ int smu_v11_0_parse_pptable(struct smu_context *smu)
 	struct smu_table_context *table_context = &smu->smu_table;
 	struct smu_table *table = &table_context->tables[SMU_TABLE_PPTABLE];
 
-	if (table_context->driver_pptable)
-		return -EINVAL;
+	if (table_context->driver_pptable) {
+		kfree(table_context->driver_pptable);
+		table_context->driver_pptable = NULL;
+	}
 
 	table_context->driver_pptable = kzalloc(table->size, GFP_KERNEL);
 
--
2.7.4



More information about the amd-gfx mailing list