Commit 0f48a4b8 authored by Sung-huai Wang's avatar Sung-huai Wang Committed by Alex Deucher
Browse files

drm/amd/display: add a NULL pointer check



[Why & How]

We have to check if stream is properly initialized before calling
find_matching_pll(), otherwise we might end up trying to deferecence a
NULL pointer.

Cc: stable@vger.kernel.org # 6.1+
Reviewed-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Acked-by: default avatarHamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: default avatarSung-huai Wang <danny.wang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a99a4ff6
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -974,10 +974,12 @@ enum dc_status resource_map_phy_clock_resources(
		|| dc_is_virtual_signal(pipe_ctx->stream->signal))
		pipe_ctx->clock_source =
				dc->res_pool->dp_clock_source;
	else
	else {
		if (stream && stream->link && stream->link->link_enc)
			pipe_ctx->clock_source = find_matching_pll(
				&context->res_ctx, dc->res_pool,
				stream);
	}

	if (pipe_ctx->clock_source == NULL)
		return DC_NO_CLOCK_SOURCE_RESOURCE;