drm/amd/display: fix memory leak in resource pools
[why] ddc engines were recently changed to be independently tracked from pipe count. the change was reflected in resource constructor but not in destructor. this manifests as a memory leak when pipe harvesting is enabled, since not all constructed ddc engines are freed [how] make destructor symmetric with constructor for all dcX_resource Signed-off-by: Jun Lei <Jun.Lei@amd.com> Reviewed-by: Aric Cyr <Aric.Cyr@amd.com> Acked-by: Leo Li <sunpeng.li@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
5e174ce63e
commit
88ed9fb77e
@ -689,7 +689,9 @@ static void destruct(struct dce110_resource_pool *pool)
|
||||
kfree(DCE110TG_FROM_TG(pool->base.timing_generators[i]));
|
||||
pool->base.timing_generators[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < pool->base.res_cap->num_ddc; i++) {
|
||||
if (pool->base.engines[i] != NULL)
|
||||
dce110_engine_destroy(&pool->base.engines[i]);
|
||||
if (pool->base.hw_i2cs[i] != NULL) {
|
||||
|
@ -719,7 +719,9 @@ static void destruct(struct dce110_resource_pool *pool)
|
||||
kfree(DCE110TG_FROM_TG(pool->base.timing_generators[i]));
|
||||
pool->base.timing_generators[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < pool->base.res_cap->num_ddc; i++) {
|
||||
if (pool->base.engines[i] != NULL)
|
||||
dce110_engine_destroy(&pool->base.engines[i]);
|
||||
if (pool->base.hw_i2cs[i] != NULL) {
|
||||
|
@ -693,9 +693,6 @@ static void destruct(struct dce110_resource_pool *pool)
|
||||
if (pool->base.opps[i] != NULL)
|
||||
dce110_opp_destroy(&pool->base.opps[i]);
|
||||
|
||||
if (pool->base.engines[i] != NULL)
|
||||
dce110_engine_destroy(&pool->base.engines[i]);
|
||||
|
||||
if (pool->base.transforms[i] != NULL)
|
||||
dce112_transform_destroy(&pool->base.transforms[i]);
|
||||
|
||||
@ -711,6 +708,11 @@ static void destruct(struct dce110_resource_pool *pool)
|
||||
kfree(DCE110TG_FROM_TG(pool->base.timing_generators[i]));
|
||||
pool->base.timing_generators[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < pool->base.res_cap->num_ddc; i++) {
|
||||
if (pool->base.engines[i] != NULL)
|
||||
dce110_engine_destroy(&pool->base.engines[i]);
|
||||
if (pool->base.hw_i2cs[i] != NULL) {
|
||||
kfree(pool->base.hw_i2cs[i]);
|
||||
pool->base.hw_i2cs[i] = NULL;
|
||||
|
@ -533,7 +533,9 @@ static void destruct(struct dce110_resource_pool *pool)
|
||||
kfree(DCE110TG_FROM_TG(pool->base.timing_generators[i]));
|
||||
pool->base.timing_generators[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < pool->base.res_cap->num_ddc; i++) {
|
||||
if (pool->base.engines[i] != NULL)
|
||||
dce110_engine_destroy(&pool->base.engines[i]);
|
||||
if (pool->base.hw_i2cs[i] != NULL) {
|
||||
|
@ -738,7 +738,9 @@ static void destruct(struct dce110_resource_pool *pool)
|
||||
kfree(DCE110TG_FROM_TG(pool->base.timing_generators[i]));
|
||||
pool->base.timing_generators[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < pool->base.res_cap->num_ddc; i++) {
|
||||
if (pool->base.engines[i] != NULL)
|
||||
dce110_engine_destroy(&pool->base.engines[i]);
|
||||
if (pool->base.hw_i2cs[i] != NULL) {
|
||||
|
@ -896,7 +896,9 @@ static void destruct(struct dcn10_resource_pool *pool)
|
||||
kfree(DCN10TG_FROM_TG(pool->base.timing_generators[i]));
|
||||
pool->base.timing_generators[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < pool->base.res_cap->num_ddc; i++) {
|
||||
if (pool->base.engines[i] != NULL)
|
||||
pool->base.engines[i]->funcs->destroy_engine(&pool->base.engines[i]);
|
||||
if (pool->base.hw_i2cs[i] != NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user