]> git.dujemihanovic.xyz Git - linux.git/commitdiff
drm/amd/display: Check null pointers before using dc->clk_mgr
authorAlex Hung <alex.hung@amd.com>
Mon, 29 Jul 2024 21:29:09 +0000 (15:29 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 13 Aug 2024 14:32:17 +0000 (10:32 -0400)
[WHY & HOW]
dc->clk_mgr is null checked previously in the same function, indicating
it might be null.

Passing "dc" to "dc->hwss.apply_idle_power_optimizations", which
dereferences null "dc->clk_mgr". (The function pointer resolves to
"dcn35_apply_idle_power_optimizations".)

This fixes 1 FORWARD_NULL issue reported by Coverity.

Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c

index b1253e4c81a8fe21e0e4e9cd2fb40e5fe3c61043..3ba2acfdae2a3c177d25c7479a336b88ee8c635f 100644 (file)
@@ -5425,7 +5425,8 @@ void dc_allow_idle_optimizations_internal(struct dc *dc, bool allow, char const
        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;
 }