drm/amd/display: add a NULL pointer check
authorjsg <jsg@openbsd.org>
Wed, 26 Jul 2023 06:33:09 +0000 (06:33 +0000)
committerjsg <jsg@openbsd.org>
Wed, 26 Jul 2023 06:33:09 +0000 (06:33 +0000)
From Sung-huai Wang
ad85fc99d6389bde08dc1dec55a2443514feba6e in linux-6.1.y/6.1.40
0f48a4b83610cb0e4e0bc487800ab69f51b4aca6 in mainline linux

sys/dev/pci/drm/amd/display/dc/dce112/dce112_resource.c

index e179e80..19d7cfa 100644 (file)
@@ -970,10 +970,12 @@ enum dc_status resource_map_phy_clock_resources(
                || dc_is_virtual_signal(pipe_ctx->stream->signal))
                pipe_ctx->clock_source =
                                dc->res_pool->dp_clock_source;
-       else
-               pipe_ctx->clock_source = find_matching_pll(
-                       &context->res_ctx, dc->res_pool,
-                       stream);
+       else {
+               if (stream && stream->link && stream->link->link_enc)
+                       pipe_ctx->clock_source = find_matching_pll(
+                               &context->res_ctx, dc->res_pool,
+                               stream);
+       }
 
        if (pipe_ctx->clock_source == NULL)
                return DC_NO_CLOCK_SOURCE_RESOURCE;