mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 22:37:01 +07:00
drm/amd/display: Do not create memory allocation if stats not enabled
Signed-off-by: Anthony Koo <Anthony.Koo@amd.com> Reviewed-by: Aric Cyr <Aric.Cyr@amd.com> Acked-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
339cc82ae6
commit
c4b0faae71
@ -115,18 +115,22 @@ struct mod_stats *mod_stats_create(struct dc *dc)
|
||||
®_data, sizeof(unsigned int), &flag))
|
||||
core_stats->enabled = reg_data;
|
||||
|
||||
core_stats->entries = DAL_STATS_ENTRIES_REGKEY_DEFAULT;
|
||||
if (dm_read_persistent_data(dc->ctx, NULL, NULL,
|
||||
DAL_STATS_ENTRIES_REGKEY,
|
||||
®_data, sizeof(unsigned int), &flag)) {
|
||||
if (reg_data > DAL_STATS_ENTRIES_REGKEY_MAX)
|
||||
core_stats->entries = DAL_STATS_ENTRIES_REGKEY_MAX;
|
||||
else
|
||||
core_stats->entries = reg_data;
|
||||
}
|
||||
if (core_stats->enabled) {
|
||||
core_stats->entries = DAL_STATS_ENTRIES_REGKEY_DEFAULT;
|
||||
if (dm_read_persistent_data(dc->ctx, NULL, NULL,
|
||||
DAL_STATS_ENTRIES_REGKEY,
|
||||
®_data, sizeof(unsigned int), &flag)) {
|
||||
if (reg_data > DAL_STATS_ENTRIES_REGKEY_MAX)
|
||||
core_stats->entries = DAL_STATS_ENTRIES_REGKEY_MAX;
|
||||
else
|
||||
core_stats->entries = reg_data;
|
||||
}
|
||||
|
||||
core_stats->time = kzalloc(sizeof(struct stats_time_cache) * core_stats->entries,
|
||||
GFP_KERNEL);
|
||||
core_stats->time = kzalloc(sizeof(struct stats_time_cache) * core_stats->entries,
|
||||
GFP_KERNEL);
|
||||
} else {
|
||||
core_stats->entries = 0;
|
||||
}
|
||||
|
||||
if (core_stats->time == NULL)
|
||||
goto fail_construct;
|
||||
|
Loading…
Reference in New Issue
Block a user