drm/amd/display: Fix late derefrence 'dsc' check in 'link_set_dsc_pps_packet()'
authorjsg <jsg@openbsd.org>
Fri, 2 Feb 2024 03:30:24 +0000 (03:30 +0000)
committerjsg <jsg@openbsd.org>
Fri, 2 Feb 2024 03:30:24 +0000 (03:30 +0000)
From Srinivasan Shanmugam
6aa5ede6665122f4c8abce3c6eba06b49e54d25c in linux-6.6.y/6.6.15
3bb9b1f958c3d986ed90a3ff009f1e77e9553207 in mainline linux

sys/dev/pci/drm/amd/display/dc/link/link_dpms.c

index f2f3ba1..87a2f12 100644 (file)
@@ -873,11 +873,15 @@ bool link_set_dsc_pps_packet(struct pipe_ctx *pipe_ctx, bool enable, bool immedi
 {
        struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc;
        struct dc_stream_state *stream = pipe_ctx->stream;
-       DC_LOGGER_INIT(dsc->ctx->logger);
 
-       if (!pipe_ctx->stream->timing.flags.DSC || !dsc)
+       if (!pipe_ctx->stream->timing.flags.DSC)
                return false;
 
+       if (!dsc)
+               return false;
+
+       DC_LOGGER_INIT(dsc->ctx->logger);
+
        if (enable) {
                struct dsc_config dsc_cfg;
                uint8_t dsc_packed_pps[128];