drm/amd/display: Fix variable deferencing before NULL check in edp_setup_replay()
authorjsg <jsg@openbsd.org>
Fri, 2 Feb 2024 03:23:33 +0000 (03:23 +0000)
committerjsg <jsg@openbsd.org>
Fri, 2 Feb 2024 03:23:33 +0000 (03:23 +0000)
From Srinivasan Shanmugam
22ae604aea14756954e1c00ae653e34d2afd2935 in linux-6.6.y/6.6.15
7073934f5d73f8b53308963cee36f0d389ea857c in mainline linux

sys/dev/pci/drm/amd/display/dc/link/protocols/link_edp_panel_control.c

index 13c3d7f..6f64aab 100644 (file)
@@ -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) {