Skip to content

Commit 7a88f23

Browse files
dinghaoliualexdeucher
authored andcommitted
drm/amd/pm: fix a memleak in aldebaran_tables_init
When kzalloc() for smu_table->ecc_table fails, we should free the previously allocated resources to prevent memleak. Fixes: edd7942 ("drm/amd/pm: add message smu to get ecc_table v2") Signed-off-by: Dinghao Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent e222b36 commit 7a88f23

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,11 @@ static int aldebaran_tables_init(struct smu_context *smu)
257257
}
258258

259259
smu_table->ecc_table = kzalloc(tables[SMU_TABLE_ECCINFO].size, GFP_KERNEL);
260-
if (!smu_table->ecc_table)
260+
if (!smu_table->ecc_table) {
261+
kfree(smu_table->metrics_table);
262+
kfree(smu_table->gpu_metrics_table);
261263
return -ENOMEM;
264+
}
262265

263266
return 0;
264267
}

0 commit comments

Comments
 (0)