Skip to content

Commit 7073934

Browse files
srishanmalexdeucher
authored andcommitted
drm/amd/display: Fix variable deferencing before NULL check in edp_setup_replay()
In edp_setup_replay(), 'struct dc *dc' & 'struct dmub_replay *replay' was dereferenced before the pointer 'link' & 'replay' NULL check. Fixes the below: drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_edp_panel_control.c:947 edp_setup_replay() warn: variable dereferenced before check 'link' (see line 933) Cc: stable@vger.kernel.org Cc: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com> Cc: Harry Wentland <harry.wentland@amd.com> Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com> Cc: Aurabindo Pillai <aurabindo.pillai@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com> Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 2b9a073 commit 7073934

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -930,8 +930,8 @@ bool edp_get_replay_state(const struct dc_link *link, uint64_t *state)
930930
bool edp_setup_replay(struct dc_link *link, const struct dc_stream_state *stream)
931931
{
932932
/* To-do: Setup Replay */
933-
struct dc *dc = link->ctx->dc;
934-
struct dmub_replay *replay = dc->res_pool->replay;
933+
struct dc *dc;
934+
struct dmub_replay *replay;
935935
int i;
936936
unsigned int panel_inst;
937937
struct replay_context replay_context = { 0 };
@@ -947,6 +947,10 @@ bool edp_setup_replay(struct dc_link *link, const struct dc_stream_state *stream
947947
if (!link)
948948
return false;
949949

950+
dc = link->ctx->dc;
951+
952+
replay = dc->res_pool->replay;
953+
950954
if (!replay)
951955
return false;
952956

@@ -975,8 +979,7 @@ bool edp_setup_replay(struct dc_link *link, const struct dc_stream_state *stream
975979

976980
replay_context.line_time_in_ns = lineTimeInNs;
977981

978-
if (replay)
979-
link->replay_settings.replay_feature_enabled =
982+
link->replay_settings.replay_feature_enabled =
980983
replay->funcs->replay_copy_settings(replay, link, &replay_context, panel_inst);
981984
if (link->replay_settings.replay_feature_enabled) {
982985

0 commit comments

Comments
 (0)