mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
drm/amd/pm: fix a memleak in aldebaran_tables_init
[ Upstream commit 7a88f23e768491bae653b444a96091d2aaeb0818 ]
When kzalloc() for smu_table->ecc_table fails, we should free
the previously allocated resources to prevent memleak.
Fixes: edd7942085 ("drm/amd/pm: add message smu to get ecc_table v2")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
59862b8692
commit
0e0a951668
@@ -258,8 +258,11 @@ static int aldebaran_tables_init(struct smu_context *smu)
|
||||
}
|
||||
|
||||
smu_table->ecc_table = kzalloc(tables[SMU_TABLE_ECCINFO].size, GFP_KERNEL);
|
||||
if (!smu_table->ecc_table)
|
||||
if (!smu_table->ecc_table) {
|
||||
kfree(smu_table->metrics_table);
|
||||
kfree(smu_table->gpu_metrics_table);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user