Skip to contentSkip to conversation

drm/amd/pp: Fix static checker warning

PATCH In review Rex Zhu 2 participants 2 messages May 18, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/1 drm/amd/pp: Fix static checker warning

error: uninitialized symbol 'xxxx'

---
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c   | 24 +++++++++-------------
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  3 ++-
 drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c |  6 ++----
 3 files changed, 14 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c +10 -14
index ec38c9f..7047e29 100644
@@ -1104,10 +1104,8 @@ int atomctrl_get_voltage_evv_on_sclk(
 			GetIndexIntoMasterTable(COMMAND, GetVoltageInfo),
 			(uint32_t *)&get_voltage_info_param_space);
 
-	if (0 != result)
-		return result;
-
-	*voltage = le16_to_cpu(((GET_EVV_VOLTAGE_INFO_OUTPUT_PARAMETER_V1_2 *)
+	*voltage = result ? 0 :
+			le16_to_cpu(((GET_EVV_VOLTAGE_INFO_OUTPUT_PARAMETER_V1_2 *)
 				(&get_voltage_info_param_space))->usVoltageLevel);
 
 	return result;
@@ -1312,8 +1310,7 @@ int atomctrl_read_efuse(struct pp_hwmgr *hwmgr, uint16_t start_index,
 	result = amdgpu_atom_execute_table(adev->mode_info.atom_context,
 			GetIndexIntoMasterTable(COMMAND, ReadEfuseValue),
 			(uint32_t *)&efuse_param);
-	if (!result)
-		*efuse = le32_to_cpu(efuse_param.ulEfuseValue) & mask;
+	*efuse = result ? 0 : le32_to_cpu(efuse_param.ulEfuseValue) & mask;
 
 	return result;
 }
@@ -1354,11 +1351,8 @@ int atomctrl_get_voltage_evv_on_sclk_ai(struct pp_hwmgr *hwmgr, uint8_t voltage_
 			GetIndexIntoMasterTable(COMMAND, GetVoltageInfo),
 			(uint32_t *)&get_voltage_info_param_space);
 
-	if (0 != result)
-		return result;
-
-	*voltage = le32_to_cpu(((GET_EVV_VOLTAGE_INFO_OUTPUT_PARAMETER_V1_3 *)
-				(&get_voltage_info_param_space))->ulVoltageLevel);
+	*voltage = result ? 0 :
+		le32_to_cpu(((GET_EVV_VOLTAGE_INFO_OUTPUT_PARAMETER_V1_3 *)(&get_voltage_info_param_space))->ulVoltageLevel);
 
 	return result;
 }
@@ -1552,15 +1546,17 @@ void atomctrl_get_voltage_range(struct pp_hwmgr *hwmgr, uint32_t *max_vddc,
 		case CHIP_FIJI:
 			*max_vddc = le32_to_cpu(((ATOM_ASIC_PROFILING_INFO_V3_3 *)profile)->ulMaxVddc/4);
 			*min_vddc = le32_to_cpu(((ATOM_ASIC_PROFILING_INFO_V3_3 *)profile)->ulMinVddc/4);
-			break;
+			return;
 		case CHIP_POLARIS11:
 		case CHIP_POLARIS10:
 		case CHIP_POLARIS12:
 			*max_vddc = le32_to_cpu(((ATOM_ASIC_PROFILING_INFO_V3_6 *)profile)->ulMaxVddc/100);
 			*min_vddc = le32_to_cpu(((ATOM_ASIC_PROFILING_INFO_V3_6 *)profile)->ulMinVddc/100);
-			break;
-		default:
 			return;
+		default:
+			break;
 		}
 	}
+	*max_vddc = 0;
+	*min_vddc = 0;
 }
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +2 -1
index 646c9e9..45e9b8c 100644
@@ -860,7 +860,8 @@ static void smu7_setup_voltage_range_from_vbios(struct pp_hwmgr *hwmgr)
 	struct phm_ppt_v1_clock_voltage_dependency_table *dep_sclk_table;
 	struct phm_ppt_v1_information *table_info =
 			(struct phm_ppt_v1_information *)(hwmgr->pptable);
-	uint32_t min_vddc, max_vddc;
+	uint32_t min_vddc = 0;
+	uint32_t max_vddc = 0;
 
 	if (!table_info)
 		return;
drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c +2 -4
index 64d33b7..d644a9b 100644
@@ -283,11 +283,9 @@ int smu7_read_smc_sram_dword(struct pp_hwmgr *hwmgr, uint32_t smc_addr, uint32_t
 
 	result = smu7_set_smc_sram_address(hwmgr, smc_addr, limit);
 
-	if (result)
-		return result;
+	*value = result ? 0 : cgs_read_register(hwmgr->device, mmSMC_IND_DATA_11);
 
-	*value = cgs_read_register(hwmgr->device, mmSMC_IND_DATA_11);
-	return 0;
+	return result;
 }
 
 int smu7_write_smc_sram_dword(struct pp_hwmgr *hwmgr, uint32_t smc_addr, uint32_t value, uint32_t limit)
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1526624893-30028-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 3 lines · Rex Zhu

error: uninitialized symbol 'xxxx'

Quoted 103 lines
---
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c   | 24 +++++++++-------------
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  3 ++-
 drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c |  6 ++----
 3 files changed, 14 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c +10 -14
index ec38c9f..7047e29 100644
@@ -1104,10 +1104,8 @@ int atomctrl_get_voltage_evv_on_sclk(
                        GetIndexIntoMasterTable(COMMAND, GetVoltageInfo),
                        (uint32_t *)&get_voltage_info_param_space);
 
-       if (0 != result)
-               return result;
-
-       *voltage = le16_to_cpu(((GET_EVV_VOLTAGE_INFO_OUTPUT_PARAMETER_V1_2 *)
+       *voltage = result ? 0 :
+                       le16_to_cpu(((GET_EVV_VOLTAGE_INFO_OUTPUT_PARAMETER_V1_2 *)
                                (&get_voltage_info_param_space))->usVoltageLevel);
 
        return result;
@@ -1312,8 +1310,7 @@ int atomctrl_read_efuse(struct pp_hwmgr *hwmgr, uint16_t start_index,
        result = amdgpu_atom_execute_table(adev->mode_info.atom_context,
                        GetIndexIntoMasterTable(COMMAND, ReadEfuseValue),
                        (uint32_t *)&efuse_param);
-       if (!result)
-               *efuse = le32_to_cpu(efuse_param.ulEfuseValue) & mask;
+       *efuse = result ? 0 : le32_to_cpu(efuse_param.ulEfuseValue) & mask;
 
        return result;
 }
@@ -1354,11 +1351,8 @@ int atomctrl_get_voltage_evv_on_sclk_ai(struct pp_hwmgr *hwmgr, uint8_t voltage_
                        GetIndexIntoMasterTable(COMMAND, GetVoltageInfo),
                        (uint32_t *)&get_voltage_info_param_space);
 
-       if (0 != result)
-               return result;
-
-       *voltage = le32_to_cpu(((GET_EVV_VOLTAGE_INFO_OUTPUT_PARAMETER_V1_3 *)
-                               (&get_voltage_info_param_space))->ulVoltageLevel);
+       *voltage = result ? 0 :
+               le32_to_cpu(((GET_EVV_VOLTAGE_INFO_OUTPUT_PARAMETER_V1_3 *)(&get_voltage_info_param_space))->ulVoltageLevel);
 
        return result;
 }
@@ -1552,15 +1546,17 @@ void atomctrl_get_voltage_range(struct pp_hwmgr *hwmgr, uint32_t *max_vddc,
                case CHIP_FIJI:
                        *max_vddc = le32_to_cpu(((ATOM_ASIC_PROFILING_INFO_V3_3 *)profile)->ulMaxVddc/4);
                        *min_vddc = le32_to_cpu(((ATOM_ASIC_PROFILING_INFO_V3_3 *)profile)->ulMinVddc/4);
-                       break;
+                       return;
                case CHIP_POLARIS11:
                case CHIP_POLARIS10:
                case CHIP_POLARIS12:
                        *max_vddc = le32_to_cpu(((ATOM_ASIC_PROFILING_INFO_V3_6 *)profile)->ulMaxVddc/100);
                        *min_vddc = le32_to_cpu(((ATOM_ASIC_PROFILING_INFO_V3_6 *)profile)->ulMinVddc/100);
-                       break;
-               default:
                        return;
+               default:
+                       break;
                }
        }
+       *max_vddc = 0;
+       *min_vddc = 0;
 }
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +2 -1
index 646c9e9..45e9b8c 100644
@@ -860,7 +860,8 @@ static void smu7_setup_voltage_range_from_vbios(struct pp_hwmgr *hwmgr)
        struct phm_ppt_v1_clock_voltage_dependency_table *dep_sclk_table;
        struct phm_ppt_v1_information *table_info =
                        (struct phm_ppt_v1_information *)(hwmgr->pptable);
-       uint32_t min_vddc, max_vddc;
+       uint32_t min_vddc = 0;
+       uint32_t max_vddc = 0;
 
        if (!table_info)
                return;
drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c +2 -5
index 64d33b7..d644a9b 100644
@@ -283,11 +283,9 @@ int smu7_read_smc_sram_dword(struct pp_hwmgr *hwmgr, uint32_t smc_addr, uint32_t
 
        result = smu7_set_smc_sram_address(hwmgr, smc_addr, limit);
 
-       if (result)
-               return result;
+       *value = result ? 0 : cgs_read_register(hwmgr->device, mmSMC_IND_DATA_11);
 
-       *value = cgs_read_register(hwmgr->device, mmSMC_IND_DATA_11);
-       return 0;
+       return result;
 }
 
 int smu7_write_smc_sram_dword(struct pp_hwmgr *hwmgr, uint32_t smc_addr, uint32_t value, uint32_t limit)
--

1.9.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx