drm/amd/display: Fix NULL pointer dereference at hibernate
authorMario Limonciello <mario.limonciello@amd.com>
Wed, 29 Nov 2023 00:35:09 +0000 (18:35 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 30 Nov 2023 23:26:31 +0000 (18:26 -0500)
During hibernate sequence the source context might not have a clk_mgr.
So don't use it to look for DML2 support.

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2980
Fixes: 7966f319c66d ("drm/amd/display: Introduce DML2")
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_resource.c

index f3a9fdd2340de48da7b00e74cb8ac425c79e8a58..e1c02527d04ae85c512d78bf063ce0aa1fc2053d 100644 (file)
@@ -4554,7 +4554,7 @@ void dc_resource_state_copy_construct(
        struct dml2_context *dml2 = NULL;
 
        // Need to preserve allocated dml2 context
-       if (src_ctx->clk_mgr->ctx->dc->debug.using_dml2)
+       if (src_ctx->clk_mgr && src_ctx->clk_mgr->ctx->dc->debug.using_dml2)
                dml2 = dst_ctx->bw_ctx.dml2;
 #endif
 
@@ -4562,7 +4562,7 @@ void dc_resource_state_copy_construct(
 
 #ifdef CONFIG_DRM_AMD_DC_FP
        // Preserve allocated dml2 context
-       if (src_ctx->clk_mgr->ctx->dc->debug.using_dml2)
+       if (src_ctx->clk_mgr && src_ctx->clk_mgr->ctx->dc->debug.using_dml2)
                dst_ctx->bw_ctx.dml2 = dml2;
 #endif