Commit c4b0faae authored by Anthony Koo's avatar Anthony Koo Committed by Alex Deucher

drm/amd/display: Do not create memory allocation if stats not enabled

Signed-off-by: default avatarAnthony Koo <Anthony.Koo@amd.com>
Reviewed-by: default avatarAric Cyr <Aric.Cyr@amd.com>
Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 339cc82a
...@@ -115,18 +115,22 @@ struct mod_stats *mod_stats_create(struct dc *dc) ...@@ -115,18 +115,22 @@ struct mod_stats *mod_stats_create(struct dc *dc)
&reg_data, sizeof(unsigned int), &flag)) &reg_data, sizeof(unsigned int), &flag))
core_stats->enabled = reg_data; core_stats->enabled = reg_data;
core_stats->entries = DAL_STATS_ENTRIES_REGKEY_DEFAULT; if (core_stats->enabled) {
if (dm_read_persistent_data(dc->ctx, NULL, NULL, core_stats->entries = DAL_STATS_ENTRIES_REGKEY_DEFAULT;
DAL_STATS_ENTRIES_REGKEY, if (dm_read_persistent_data(dc->ctx, NULL, NULL,
&reg_data, sizeof(unsigned int), &flag)) { DAL_STATS_ENTRIES_REGKEY,
if (reg_data > DAL_STATS_ENTRIES_REGKEY_MAX) &reg_data, sizeof(unsigned int), &flag)) {
core_stats->entries = DAL_STATS_ENTRIES_REGKEY_MAX; if (reg_data > DAL_STATS_ENTRIES_REGKEY_MAX)
else core_stats->entries = DAL_STATS_ENTRIES_REGKEY_MAX;
core_stats->entries = reg_data; else
} core_stats->entries = reg_data;
}
core_stats->time = kzalloc(sizeof(struct stats_time_cache) * core_stats->entries, core_stats->time = kzalloc(sizeof(struct stats_time_cache) * core_stats->entries,
GFP_KERNEL); GFP_KERNEL);
} else {
core_stats->entries = 0;
}
if (core_stats->time == NULL) if (core_stats->time == NULL)
goto fail_construct; goto fail_construct;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment