Commit 252f3d95 authored by Harry Wentland's avatar Harry Wentland Committed by Alex Deucher
Browse files

drm/amd/display: Remove unnecessary NULL check in set_preferred_link_settings



[Why]
link_stream is never NULL here as we've dereferenced it a couple lines before
and have done so for a couple months now.

[How]
- Drop the NULL check.
- Initialize where we know link_stream is non-NULL

Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
Reviewed-by: default avatarNicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: default avatarLeo Li <sunpeng.li@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 03f3e40c
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -3023,22 +3023,21 @@ void dc_link_set_preferred_link_settings(struct dc *dc,
	for (i = 0; i < MAX_PIPES; i++) {
		pipe = &dc->current_state->res_ctx.pipe_ctx[i];
		if (pipe->stream && pipe->stream->link) {
			if (pipe->stream->link == link)
			if (pipe->stream->link == link) {
				link_stream = pipe->stream;
				break;
			}
		}
	}

	/* Stream not found */
	if (i == MAX_PIPES)
		return;

	link_stream = link->dc->current_state->res_ctx.pipe_ctx[i].stream;

	/* Cannot retrain link if backend is off */
	if (link_stream->dpms_off)
		return;

	if (link_stream)
	decide_link_settings(link_stream, &store_settings);

	if ((store_settings.lane_count != LANE_COUNT_UNKNOWN) &&