drm/amd/display: Check link_res->hpo_dp_link_enc before using it
authorjsg <jsg@openbsd.org>
Fri, 11 Oct 2024 02:25:18 +0000 (02:25 +0000)
committerjsg <jsg@openbsd.org>
Fri, 11 Oct 2024 02:25:18 +0000 (02:25 +0000)
From Alex Hung
be2ca7a2c1561390d28bf2f92654d819659ba510 in linux-6.6.y/6.6.55
0beca868cde8742240cd0038141c30482d2b7eb8 in mainline linux

sys/dev/pci/drm/amd/display/dc/link/hwss/link_hwss_hpo_dp.c

index 5dd5bd6..d0b0553 100644 (file)
@@ -28,6 +28,8 @@
 #include "dccg.h"
 #include "clk_mgr.h"
 
+#define DC_LOGGER link->ctx->logger
+
 void set_hpo_dp_throttled_vcp_size(struct pipe_ctx *pipe_ctx,
                struct fixed31_32 throttled_vcp_size)
 {
@@ -124,6 +126,11 @@ void disable_hpo_dp_link_output(struct dc_link *link,
                const struct link_resource *link_res,
                enum amd_signal_type signal)
 {
+       if (!link_res->hpo_dp_link_enc) {
+               DC_LOG_ERROR("%s: invalid hpo_dp_link_enc\n", __func__);
+               return;
+       }
+
                link_res->hpo_dp_link_enc->funcs->link_disable(link_res->hpo_dp_link_enc);
                link_res->hpo_dp_link_enc->funcs->disable_link_phy(
                                link_res->hpo_dp_link_enc, signal);