drm/amd/display: Check null pointers before using dc->clk_mgr
authorjsg <jsg@openbsd.org>
Fri, 11 Oct 2024 02:13:25 +0000 (02:13 +0000)
committerjsg <jsg@openbsd.org>
Fri, 11 Oct 2024 02:13:25 +0000 (02:13 +0000)
From Alex Hung
9641bc4adf8446034e490ed543ae7e9833cfbdf5 in linux-6.6.y/6.6.55
95d9e0803e51d5a24276b7643b244c7477daf463 in mainline linux

sys/dev/pci/drm/amd/display/dc/core/amdgpu_dc.c

index 0b2eb2a..a7a6f6c 100644 (file)
@@ -4716,7 +4716,8 @@ void dc_allow_idle_optimizations(struct dc *dc, bool allow)
        if (allow == dc->idle_optimizations_allowed)
                return;
 
-       if (dc->hwss.apply_idle_power_optimizations && dc->hwss.apply_idle_power_optimizations(dc, allow))
+       if (dc->hwss.apply_idle_power_optimizations && dc->clk_mgr != NULL &&
+           dc->hwss.apply_idle_power_optimizations(dc, allow))
                dc->idle_optimizations_allowed = allow;
 }