drm/amdgpu/display: check if ppfuncs exists before using it
authorAlex Deucher <alexander.deucher@amd.com>
Wed, 30 May 2018 14:34:23 +0000 (09:34 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 30 May 2018 17:38:05 +0000 (12:38 -0500)
Fixes a crash on asics without powerplay yet (e.g., vega20).

Reviewed-by: Rex Zhu<rezhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c

index d5e6b45..5a33461 100644 (file)
@@ -343,7 +343,7 @@ bool dm_pp_get_clock_levels_by_type_with_latency(
        struct pp_clock_levels_with_latency pp_clks = { 0 };
        const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
 
-       if (!pp_funcs->get_clock_by_type_with_latency)
+       if (!pp_funcs || !pp_funcs->get_clock_by_type_with_latency)
                return false;
 
        if (pp_funcs->get_clock_by_type_with_latency(pp_handle,