Commit fa9e6991 authored by Rex Zhu's avatar Rex Zhu Committed by Alex Deucher

drm/amd/powerplay: add powerplay valid check to avoid null point.

In case CONFIG_DRM_AMD_POWERPLAY is defined and amdgpu.powerplay=0.
some functions in powrplay can also be called by DAL. and the input parameter is *adev.
if just check point not NULL was not enough and will lead to NULL point error.
Signed-off-by: default avatarRex Zhu <Rex.Zhu@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 0f18563a
...@@ -786,7 +786,9 @@ int amd_powerplay_get_current_clocks(void *handle, ...@@ -786,7 +786,9 @@ int amd_powerplay_get_current_clocks(void *handle,
struct amd_pp_simple_clock_info simple_clocks; struct amd_pp_simple_clock_info simple_clocks;
struct pp_clock_info hw_clocks; struct pp_clock_info hw_clocks;
if (handle == NULL || clocks == NULL) PP_CHECK((struct pp_instance *)handle);
if (clocks == NULL)
return -EINVAL; return -EINVAL;
hwmgr = ((struct pp_instance *)handle)->hwmgr; hwmgr = ((struct pp_instance *)handle)->hwmgr;
...@@ -828,7 +830,9 @@ int amd_powerplay_get_clock_by_type(void *handle, enum amd_pp_clock_type type, s ...@@ -828,7 +830,9 @@ int amd_powerplay_get_clock_by_type(void *handle, enum amd_pp_clock_type type, s
struct pp_hwmgr *hwmgr; struct pp_hwmgr *hwmgr;
if (handle == NULL || clocks == NULL) PP_CHECK((struct pp_instance *)handle);
if (clocks == NULL)
return -EINVAL; return -EINVAL;
hwmgr = ((struct pp_instance *)handle)->hwmgr; hwmgr = ((struct pp_instance *)handle)->hwmgr;
...@@ -844,7 +848,9 @@ int amd_powerplay_get_display_mode_validation_clocks(void *handle, ...@@ -844,7 +848,9 @@ int amd_powerplay_get_display_mode_validation_clocks(void *handle,
int result = -1; int result = -1;
struct pp_hwmgr *hwmgr; struct pp_hwmgr *hwmgr;
if (handle == NULL || clocks == NULL) PP_CHECK((struct pp_instance *)handle);
if (clocks == NULL)
return -EINVAL; return -EINVAL;
hwmgr = ((struct pp_instance *)handle)->hwmgr; hwmgr = ((struct pp_instance *)handle)->hwmgr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment