From: jsg Date: Fri, 2 Feb 2024 03:23:33 +0000 (+0000) Subject: drm/amd/display: Fix variable deferencing before NULL check in edp_setup_replay() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=bcb49dc4db5a0811bc69b47ad05021468078e28b;p=openbsd drm/amd/display: Fix variable deferencing before NULL check in edp_setup_replay() From Srinivasan Shanmugam 22ae604aea14756954e1c00ae653e34d2afd2935 in linux-6.6.y/6.6.15 7073934f5d73f8b53308963cee36f0d389ea857c in mainline linux --- diff --git a/sys/dev/pci/drm/amd/display/dc/link/protocols/link_edp_panel_control.c b/sys/dev/pci/drm/amd/display/dc/link/protocols/link_edp_panel_control.c index 13c3d7ff613..6f64aab18f0 100644 --- a/sys/dev/pci/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +++ b/sys/dev/pci/drm/amd/display/dc/link/protocols/link_edp_panel_control.c @@ -920,8 +920,8 @@ bool edp_get_replay_state(const struct dc_link *link, uint64_t *state) bool edp_setup_replay(struct dc_link *link, const struct dc_stream_state *stream) { /* To-do: Setup Replay */ - struct dc *dc = link->ctx->dc; - struct dmub_replay *replay = dc->res_pool->replay; + struct dc *dc; + struct dmub_replay *replay; int i; unsigned int panel_inst; struct replay_context replay_context = { 0 }; @@ -937,6 +937,10 @@ bool edp_setup_replay(struct dc_link *link, const struct dc_stream_state *stream if (!link) return false; + dc = link->ctx->dc; + + replay = dc->res_pool->replay; + if (!replay) return false; @@ -965,8 +969,7 @@ bool edp_setup_replay(struct dc_link *link, const struct dc_stream_state *stream replay_context.line_time_in_ns = lineTimeInNs; - if (replay) - link->replay_settings.replay_feature_enabled = + link->replay_settings.replay_feature_enabled = replay->funcs->replay_copy_settings(replay, link, &replay_context, panel_inst); if (link->replay_settings.replay_feature_enabled) {