From 1862a094d2ab07d9ca562aa3cb57e5315dc95469 Mon Sep 17 00:00:00 2001 From: jsg Date: Fri, 2 Feb 2024 03:30:24 +0000 Subject: [PATCH] drm/amd/display: Fix late derefrence 'dsc' check in 'link_set_dsc_pps_packet()' 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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/drm/amd/display/dc/link/link_dpms.c b/sys/dev/pci/drm/amd/display/dc/link/link_dpms.c index f2f3ba15be7..87a2f12aeb4 100644 --- a/sys/dev/pci/drm/amd/display/dc/link/link_dpms.c +++ b/sys/dev/pci/drm/amd/display/dc/link/link_dpms.c @@ -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]; -- 2.20.1