[110/138] drm/amd/powerplay: remove unnecessary checking in smu_hw_fini

Submitted by Huang, Ray on Jan. 25, 2019, 10:25 a.m.

Details

Message ID 1548411945-12396-111-git-send-email-ray.huang@amd.com
State New
Headers show
Series "The new SW SMU driver of amdgpu" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Huang, Ray Jan. 25, 2019, 10:25 a.m.
This patch removes unnecessary NULL pointer checking in smu_hw_fini, because
kfree is able to handle NULL pointer case.

Suggested-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 54 ++++++++++--------------------
 1 file changed, 18 insertions(+), 36 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 2e3e084..eed6cb9 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -677,50 +677,32 @@  static int smu_hw_fini(void *handle)
 	if (!is_support_sw_smu(adev))
 		return -EINVAL;
 
-	if (smu_dpm->dpm_context) {
-		kfree(smu_dpm->dpm_context);
-		smu_dpm->dpm_context = NULL;
-	}
+	kfree(smu_dpm->dpm_context);
+	smu_dpm->dpm_context = NULL;
 
-	if (smu_dpm->golden_dpm_context) {
-		kfree(smu_dpm->golden_dpm_context);
-		smu_dpm->golden_dpm_context = NULL;
-	}
+	kfree(smu_dpm->golden_dpm_context);
+	smu_dpm->golden_dpm_context = NULL;
 
-	if (table_context->driver_pptable) {
-		kfree(table_context->driver_pptable);
-		table_context->driver_pptable = NULL;
-	}
+	kfree(table_context->driver_pptable);
+	table_context->driver_pptable = NULL;
 
-	if (table_context->max_sustainable_clocks) {
-		kfree(table_context->max_sustainable_clocks);
-		table_context->max_sustainable_clocks = NULL;
-	}
+	kfree(table_context->max_sustainable_clocks);
+	table_context->max_sustainable_clocks = NULL;
 
-	if (table_context->od_feature_capabilities) {
-		kfree(table_context->od_feature_capabilities);
-		table_context->od_feature_capabilities = NULL;
-	}
+	kfree(table_context->od_feature_capabilities);
+	table_context->od_feature_capabilities = NULL;
 
-	if (table_context->od_settings_max) {
-		kfree(table_context->od_settings_max);
-		table_context->od_settings_max = NULL;
-	}
+	kfree(table_context->od_settings_max);
+	table_context->od_settings_max = NULL;
 
-	if (table_context->od_settings_min) {
-		kfree(table_context->od_settings_min);
-		table_context->od_settings_min = NULL;
-	}
+	kfree(table_context->od_settings_min);
+	table_context->od_settings_min = NULL;
 
-	if (table_context->overdrive_table) {
-		kfree(table_context->overdrive_table);
-		table_context->overdrive_table = NULL;
-	}
+	kfree(table_context->overdrive_table);
+	table_context->overdrive_table = NULL;
 
-	if (table_context->od8_settings) {
-		kfree(table_context->od8_settings);
-		table_context->od8_settings = NULL;
-	}
+	kfree(table_context->od8_settings);
+	table_context->od8_settings = NULL;
 
 	ret = smu_fini_fb_allocations(smu);
 	if (ret)