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,6 +115,7 @@ struct mod_stats *mod_stats_create(struct dc *dc)
&reg_data, sizeof(unsigned int), &flag))
core_stats->enabled = 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,
......@@ -127,6 +128,9 @@ struct mod_stats *mod_stats_create(struct dc *dc)
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;
......
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