diff options
author | Eric Huang | 2016-04-15 21:02:54 +0200 |
---|---|---|
committer | Alex Deucher | 2016-05-05 02:29:52 +0200 |
commit | 1551019523a01f477888835b9ed363d3a2e73d7b (patch) | |
tree | 9fe18d674b1737d7f377e04a635681281bed5e87 /drivers/gpu/drm/amd/powerplay/hwmgr | |
parent | drm/amd/powerplay: add dpm force multiple levels on cz/tonga/fiji/polaris (v2) (diff) | |
download | kernel-qcow2-linux-1551019523a01f477888835b9ed363d3a2e73d7b.tar.gz kernel-qcow2-linux-1551019523a01f477888835b9ed363d3a2e73d7b.tar.xz kernel-qcow2-linux-1551019523a01f477888835b9ed363d3a2e73d7b.zip |
drm/amd/powerplay: revise caching the soft pptable and add it's size
This fixes a bug in the pptable access interface that could lead to
a crash. Check the pointer before using it.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay/hwmgr')
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c index 96a27876a704..10e3630ee39d 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c @@ -138,12 +138,15 @@ const void *get_powerplay_table(struct pp_hwmgr *hwmgr) u16 size; u8 frev, crev; - void *table_address; - - table_address = (ATOM_Tonga_POWERPLAYTABLE *) - cgs_atom_get_data_table(hwmgr->device, index, &size, &frev, &crev); - - hwmgr->soft_pp_table = table_address; /*Cache the result in RAM.*/ + void *table_address = (void *)hwmgr->soft_pp_table; + + if (!table_address) { + table_address = (ATOM_Tonga_POWERPLAYTABLE *) + cgs_atom_get_data_table(hwmgr->device, + index, &size, &frev, &crev); + hwmgr->soft_pp_table = table_address; /*Cache the result in RAM.*/ + hwmgr->soft_pp_table_size = size; + } return table_address; } |