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

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

parent 339cc82a
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -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;