diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2018-10-18 22:38:10 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-10-24 21:03:43 -0400 |
commit | 6f059c641b31076248ba89d0f7e0e753946a8099 (patch) | |
tree | 6058d9151248dd75acf635ae2306c79faf7ee653 /drivers | |
parent | 355c8db13be409695956c666e839f654a99cfc2d (diff) |
drm/amd/display: Fix Null point error if smu ip was disabled
from AI, SMU Ip is not indispensable to driver and can be
disabled by user via module parameter ip_block_mask.
so the pp_handle may be NULL.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c index 0fab64a2a915..12001a006b2d 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c | |||
@@ -101,7 +101,7 @@ bool dm_pp_apply_display_requirements( | |||
101 | adev->pm.pm_display_cfg.displays[i].controller_id = dc_cfg->pipe_idx + 1; | 101 | adev->pm.pm_display_cfg.displays[i].controller_id = dc_cfg->pipe_idx + 1; |
102 | } | 102 | } |
103 | 103 | ||
104 | if (adev->powerplay.pp_funcs->display_configuration_change) | 104 | if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->display_configuration_change) |
105 | adev->powerplay.pp_funcs->display_configuration_change( | 105 | adev->powerplay.pp_funcs->display_configuration_change( |
106 | adev->powerplay.pp_handle, | 106 | adev->powerplay.pp_handle, |
107 | &adev->pm.pm_display_cfg); | 107 | &adev->pm.pm_display_cfg); |
@@ -304,7 +304,7 @@ bool dm_pp_get_clock_levels_by_type( | |||
304 | struct amd_pp_simple_clock_info validation_clks = { 0 }; | 304 | struct amd_pp_simple_clock_info validation_clks = { 0 }; |
305 | uint32_t i; | 305 | uint32_t i; |
306 | 306 | ||
307 | if (adev->powerplay.pp_funcs->get_clock_by_type) { | 307 | if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->get_clock_by_type) { |
308 | if (adev->powerplay.pp_funcs->get_clock_by_type(pp_handle, | 308 | if (adev->powerplay.pp_funcs->get_clock_by_type(pp_handle, |
309 | dc_to_pp_clock_type(clk_type), &pp_clks)) { | 309 | dc_to_pp_clock_type(clk_type), &pp_clks)) { |
310 | /* Error in pplib. Provide default values. */ | 310 | /* Error in pplib. Provide default values. */ |
@@ -315,7 +315,7 @@ bool dm_pp_get_clock_levels_by_type( | |||
315 | 315 | ||
316 | pp_to_dc_clock_levels(&pp_clks, dc_clks, clk_type); | 316 | pp_to_dc_clock_levels(&pp_clks, dc_clks, clk_type); |
317 | 317 | ||
318 | if (adev->powerplay.pp_funcs->get_display_mode_validation_clocks) { | 318 | if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->get_display_mode_validation_clocks) { |
319 | if (adev->powerplay.pp_funcs->get_display_mode_validation_clocks( | 319 | if (adev->powerplay.pp_funcs->get_display_mode_validation_clocks( |
320 | pp_handle, &validation_clks)) { | 320 | pp_handle, &validation_clks)) { |
321 | /* Error in pplib. Provide default values. */ | 321 | /* Error in pplib. Provide default values. */ |
@@ -398,6 +398,9 @@ bool dm_pp_get_clock_levels_by_type_with_voltage( | |||
398 | struct pp_clock_levels_with_voltage pp_clk_info = {0}; | 398 | struct pp_clock_levels_with_voltage pp_clk_info = {0}; |
399 | const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; | 399 | const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; |
400 | 400 | ||
401 | if (!pp_funcs || !pp_funcs->get_clock_by_type_with_voltage) | ||
402 | return false; | ||
403 | |||
401 | if (pp_funcs->get_clock_by_type_with_voltage(pp_handle, | 404 | if (pp_funcs->get_clock_by_type_with_voltage(pp_handle, |
402 | dc_to_pp_clock_type(clk_type), | 405 | dc_to_pp_clock_type(clk_type), |
403 | &pp_clk_info)) | 406 | &pp_clk_info)) |
@@ -438,7 +441,7 @@ bool dm_pp_apply_clock_for_voltage_request( | |||
438 | if (!pp_clock_request.clock_type) | 441 | if (!pp_clock_request.clock_type) |
439 | return false; | 442 | return false; |
440 | 443 | ||
441 | if (adev->powerplay.pp_funcs->display_clock_voltage_request) | 444 | if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->display_clock_voltage_request) |
442 | ret = adev->powerplay.pp_funcs->display_clock_voltage_request( | 445 | ret = adev->powerplay.pp_funcs->display_clock_voltage_request( |
443 | adev->powerplay.pp_handle, | 446 | adev->powerplay.pp_handle, |
444 | &pp_clock_request); | 447 | &pp_clock_request); |
@@ -455,7 +458,7 @@ bool dm_pp_get_static_clocks( | |||
455 | struct amd_pp_clock_info pp_clk_info = {0}; | 458 | struct amd_pp_clock_info pp_clk_info = {0}; |
456 | int ret = 0; | 459 | int ret = 0; |
457 | 460 | ||
458 | if (adev->powerplay.pp_funcs->get_current_clocks) | 461 | if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->get_current_clocks) |
459 | ret = adev->powerplay.pp_funcs->get_current_clocks( | 462 | ret = adev->powerplay.pp_funcs->get_current_clocks( |
460 | adev->powerplay.pp_handle, | 463 | adev->powerplay.pp_handle, |
461 | &pp_clk_info); | 464 | &pp_clk_info); |
@@ -505,6 +508,9 @@ void pp_rv_set_wm_ranges(struct pp_smu *pp, | |||
505 | wm_with_clock_ranges.num_wm_dmif_sets = ranges->num_reader_wm_sets; | 508 | wm_with_clock_ranges.num_wm_dmif_sets = ranges->num_reader_wm_sets; |
506 | wm_with_clock_ranges.num_wm_mcif_sets = ranges->num_writer_wm_sets; | 509 | wm_with_clock_ranges.num_wm_mcif_sets = ranges->num_writer_wm_sets; |
507 | 510 | ||
511 | if (!pp_funcs || !pp_funcs->set_watermarks_for_clocks_ranges) | ||
512 | return; | ||
513 | |||
508 | for (i = 0; i < wm_with_clock_ranges.num_wm_dmif_sets; i++) { | 514 | for (i = 0; i < wm_with_clock_ranges.num_wm_dmif_sets; i++) { |
509 | if (ranges->reader_wm_sets[i].wm_inst > 3) | 515 | if (ranges->reader_wm_sets[i].wm_inst > 3) |
510 | wm_dce_clocks[i].wm_set_id = WM_SET_A; | 516 | wm_dce_clocks[i].wm_set_id = WM_SET_A; |