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: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Harry Wentland 2019-05-31 14:17:43 -04:00 committed by Alex Deucher
parent 03f3e40c8b
commit 252f3d950d

View File

@ -3023,8 +3023,10 @@ void dc_link_set_preferred_link_settings(struct dc *dc,
for (i = 0; i < MAX_PIPES; i++) { for (i = 0; i < MAX_PIPES; i++) {
pipe = &dc->current_state->res_ctx.pipe_ctx[i]; pipe = &dc->current_state->res_ctx.pipe_ctx[i];
if (pipe->stream && pipe->stream->link) { if (pipe->stream && pipe->stream->link) {
if (pipe->stream->link == link) if (pipe->stream->link == link) {
link_stream = pipe->stream;
break; break;
}
} }
} }
@ -3032,14 +3034,11 @@ void dc_link_set_preferred_link_settings(struct dc *dc,
if (i == MAX_PIPES) if (i == MAX_PIPES)
return; return;
link_stream = link->dc->current_state->res_ctx.pipe_ctx[i].stream;
/* Cannot retrain link if backend is off */ /* Cannot retrain link if backend is off */
if (link_stream->dpms_off) if (link_stream->dpms_off)
return; return;
if (link_stream) decide_link_settings(link_stream, &store_settings);
decide_link_settings(link_stream, &store_settings);
if ((store_settings.lane_count != LANE_COUNT_UNKNOWN) && if ((store_settings.lane_count != LANE_COUNT_UNKNOWN) &&
(store_settings.link_rate != LINK_RATE_UNKNOWN)) (store_settings.link_rate != LINK_RATE_UNKNOWN))