summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c
diff options
context:
space:
mode:
authorRex Zhu <Rex.Zhu@amd.com>2016-01-06 16:48:38 +0800
committerAlex Deucher <alexander.deucher@amd.com>2016-01-08 15:39:23 -0500
commitc15c8d70207d467bb4312d6ac5536c101246fdc6 (patch)
tree140ef07a32acc7e2590ad28b7e716ead3b1b595e /drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c
parent75ac63dbc3b0f4d3af67a5857790749e954e2ba6 (diff)
downloadop-kernel-dev-c15c8d70207d467bb4312d6ac5536c101246fdc6.zip
op-kernel-dev-c15c8d70207d467bb4312d6ac5536c101246fdc6.tar.gz
drm/amd/powerplay: fix Smatch static checker warnings
1. return -1 instead of -ENOMEM 2. The struct type mismatch warnings. Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Ken Wang <Qingqing.Wang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c')
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c
index 8f9d705..2f1a14f 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c
@@ -1322,11 +1322,17 @@ static int get_cac_leakage_table(struct pp_hwmgr *hwmgr,
struct phm_cac_leakage_table *cac_leakage_table;
unsigned long table_size, i;
+ if (hwmgr == NULL || table == NULL || ptable == NULL)
+ return -EINVAL;
+
table_size = sizeof(ULONG) +
(sizeof(struct phm_cac_leakage_table) * table->ucNumEntries);
cac_leakage_table = kzalloc(table_size, GFP_KERNEL);
+ if (cac_leakage_table == NULL)
+ return -ENOMEM;
+
cac_leakage_table->count = (ULONG)table->ucNumEntries;
for (i = 0; i < cac_leakage_table->count; i++) {
@@ -1349,7 +1355,7 @@ static int get_cac_leakage_table(struct pp_hwmgr *hwmgr,
static int get_platform_power_management_table(struct pp_hwmgr *hwmgr,
ATOM_PPLIB_PPM_Table *atom_ppm_table)
{
- struct phm_ppm_table *ptr = kzalloc(sizeof(ATOM_PPLIB_PPM_Table), GFP_KERNEL);
+ struct phm_ppm_table *ptr = kzalloc(sizeof(struct phm_ppm_table), GFP_KERNEL);
if (NULL == ptr)
return -ENOMEM;
@@ -1466,6 +1472,9 @@ static int init_phase_shedding_table(struct pp_hwmgr *hwmgr,
table = kzalloc(size, GFP_KERNEL);
+ if (table == NULL)
+ return -ENOMEM;
+
table->count = (unsigned long)ptable->ucNumEntries;
for (i = 0; i < table->count; i++) {
OpenPOWER on IntegriCloud