Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753260AbdH2NeM (ORCPT ); Tue, 29 Aug 2017 09:34:12 -0400 Received: from mail-dm3nam03on0059.outbound.protection.outlook.com ([104.47.41.59]:31378 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751888AbdH2NeK (ORCPT ); Tue, 29 Aug 2017 09:34:10 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Harry.Wentland@amd.com; Subject: Re: [PATCH] drm/amd/powerplay/hwmgr: Remove null check before kfree To: Himanshu Jha , airlied@linux.ie Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, alexander.deucher@amd.com, Rex.Zhu@amd.com, christian.koenig@amd.com References: <1504012347-14702-1-git-send-email-himanshujha199640@gmail.com> From: Harry Wentland Message-ID: <337d5257-2d0a-8482-f8d8-4a44234347d4@amd.com> Date: Tue, 29 Aug 2017 09:34:01 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1504012347-14702-1-git-send-email-himanshujha199640@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.55.250] X-ClientProxiedBy: BN6PR16CA0038.namprd16.prod.outlook.com (10.172.26.24) To BY2PR1201MB1096.namprd12.prod.outlook.com (10.164.168.16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 97c37a84-efe9-44a7-d3e2-08d4eee29f97 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:BY2PR1201MB1096; X-Microsoft-Exchange-Diagnostics: 1;BY2PR1201MB1096;3:SRJqQ/UKcyYr/KdSSgLwWN4RFy5kBVusxll3lWhEgZPa3MuwF7K8qMhQKLr6+8uw3/7U+IKbPuR38VxV6O93uVBqVSQPeUXT9Exuc4rzVeekQ0zjBPWrhguB/fvPI3Atrz7UfyQ9A+SQXXpGM3c8KrIMeG9WFwm0HyDVbCq/eoMwaxYQ2qs3Nzdyl2EMu60JlO4u81m7zknYhqgTaGqtZygVJepxJqcDTjcWBX3VnSrkFLWChjDCmgP2CS1uVWmy;25:UMmXVouoqHu3QLUNpJJHFj5swtxj/WVE73H+LbPEMflG+5QNIcnn6Aa2buH5VlPzs8u32KApftDUnh8rdNI/vHjJ5/6KUx7uWhEvUwPKHv9eyhKWtVpEt/AUvtURcQkOqXVaMzbKgMAu0fT9SdleZ9bAZLdBLI8kE6BpczRK4n7EMNKjHI93DkuC1PNIT6HCtO+Rk51K5GQ7kRKLohVByxhCxfbXXb2/M0Wo8RUG0SkQywG0A5Vwde7HQxzRdPFN1wQ42PyxXF8FSwRDUxIo+L6VI0fu+9O0GQh4niWvkeBKvI53/VF1fqhkR1AHAC7MhxVTC0q1iskAlr0QMwyK7g==;31:h/OtjxYZOOxxjc8NtFnh6RyAkexeOP9lkEvv6zeGjEXHQV3c7ZSFJ/W0xtGTGVkmUyZ39hGuKrvPNFHQb9O5CEqKtYwUdxO5i2m+I/5UGEnACMyPy7cLnvjI9lUQemYYcApX80dLQpfTrXDypBFj2D2ATMSDnL8w/FZ1hj3WdysQMvNNgsBXAGIaaXpIKrt+GKP9kofLBr+IeVSRg6tvQjAHvk3uQBQ+uFlRjVSTkF4= X-MS-TrafficTypeDiagnostic: BY2PR1201MB1096: X-Microsoft-Exchange-Diagnostics: 1;BY2PR1201MB1096;20:JrvkSysMkeMgfArsf7Z1zzV+2WsEAihNuXrFthT1s75fUpz82SlF8WgB3fcPknExNJD4IdHdPq/UBilocmp55bF0VewwKpLtmLom0NjK5SpK8QRSPWqnOySaxKmepE3gjspN3l2LSQMTNyyexUoizU3LDxpOJ/EW9UpqX8tm2qXFWjHONPnW7lTpcht2TwQhwlIM7VdCpka2NDB2vuccr6dluin1X+HpzlGee6HvCnfPaaN2UTKx/MjLotEOCiCUHBHO+XLUchRSM1aQj56e7b5abG6Nnet6HEVrRQzBH7De6FAt9ZlZ1jwdCH0XxtZZEOrNDCdLlDXE2SKF9ik5craXU16mFUNqas5LDKJ+tJSbA1BKytuk+AzLbRSlVoDkh4WeuDkDkwcWxAlkbfUyvrS4VQ5WqKKCA9YQvdSW/m9R27kcL5hziVPFp8psKcL8vMJO6QIiJR44XwbeaUBegYfnjs1Oz2zaF6kagIRsL5STSDWFtQ4ZMWIsP6g9Rerz;4:WF3ircpXgKXkwRN1P15hLdlyHjRddpGwx8XRsaMUAklTQjXcihtCHrvEPsNl7NGRgW9J2tDMLkNCKPuq+G92nsY3NJtWUyx3SqvXkw9i9n5lU61tumjxIUv2bmd9Wxz72P71fMYBml8nxttWq0VbJ2URuDvfR706G446BimOxejf640uUmUQjYTd6bFL9CrE6n5ZHaRtEUe33+c80exedVbjX5jHOkob+PMdoOlXAA+92mI4/Wtj9GV9fuaozXamBu0+3uN0v/mtQ/PQPPKLf0IQkzxftyqzgOS4yfsd3qQ= X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041248)(20161123562025)(20161123564025)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BY2PR1201MB1096;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BY2PR1201MB1096; X-Forefront-PRVS: 0414DF926F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(7370300001)(4630300001)(979002)(6049001)(6009001)(39860400002)(377424004)(24454002)(199003)(377454003)(189002)(7350300001)(110136004)(47776003)(65806001)(68736007)(106356001)(5660300001)(86362001)(97736004)(66066001)(65956001)(53546010)(478600001)(31696002)(64126003)(101416001)(83506001)(42186005)(2906002)(25786009)(105586002)(31686004)(7736002)(305945005)(33646002)(65826007)(50986999)(4326008)(189998001)(36756003)(229853002)(54356999)(50466002)(230700001)(76176999)(90366009)(6116002)(53936002)(3846002)(4001350100001)(6486002)(6246003)(77096006)(8676002)(2950100002)(6666003)(23676002)(72206003)(81156014)(81166006)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR1201MB1096;H:[172.29.157.193];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTJQUjEyMDFNQjEwOTY7MjM6aUZlZEVRK1ZXT2VybmlFL1RYb29iRHNH?= =?utf-8?B?WEVNUllxS0lxMzJ6bkJTYVdzVWtiSDdVYlNEVjlvMlVvS3VSeXNZT0FVVldn?= =?utf-8?B?SVZTMkF4UmxNaFo2UXVlZFR4VkY3bDQ5QmhGZmViaGh3VXl5Uk42dnBTTmgr?= =?utf-8?B?ZGVNTFdGSVRjd0xYcXI4ajRQU09QTVc4MnBHVk5FbFVlVEVFdjA1ZHNxczdW?= =?utf-8?B?ZE9CQnhaaUQ5blZwNlhyYS9PcmhVTE05cnBURzY4UjRmdS9RbWN4ckNPTTBK?= =?utf-8?B?MGovaHY2UGF6Q1oxOEx1K0xzOWk1aFNvNGtkdER3blFaamQyUDhOc2hiYUdE?= =?utf-8?B?ZlU4cjRGbGF2VnFCWmZpMlF5YlRRO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nMFuSmo5Gh0l8XjCLL1buyQQJCCDxseJiUjXA871l+du4sfvq8tXvystL8RmisryYTpl9i9gxbv9UzQE7/RuQpjSUpksMfAQgspWLodrPieYDGnWRrDMH++kB40zcidVefnb5EcNQFDuwZq3V5MMSNRWA8sc69VI653n1VlUKSR9PI2xiuU55UuHDVlwcLujV84ktxjY64kMIgbhstGYsfYW8XlPMtF+hsLX8uf6cY0BO6hMqRVpV6D3Qtgo2GMKeHHIa1tDueJp2zummQ==;5:DpKWOKmPanfu5Z5UNCZVj5+QFtIfGFA08LdIcSH4sMlPJv/hH4sdlVOMX9n1gnLpWRIphn5zuHdFhtKgI5OY5hkvuUYk+cHqIpP7e7FkKtmodV5hfUTje5w89QnG6PM3PNazV7T/1Z24H0H359K73A==;24:Pxvg6ey4jFRH0CvGkVMj2dE4evemBrTPSu2U+Ir+hDW05QYznW2qFSXOILcZVWa4yJFIzCxmBo3M+jFR2/yl4H0LaGKCbE0IJrEsntp2wpk=;7:8qGKPAttJ7bCdKoDGZIW/KcOXRgfbgwYu6YeP6Ezj+SL0Frx9OSd387jJJl2wLmnBEt85au4NblqtX8YhTxFw/i9xFh8u4y0YgDk6RATGp0KbdlnzrUAFBgqYh3RWTFAsHkfu7LpLq0vwEzPibhOWBCwERSXZmeED/oag3QAWiy2rt2R0LudoCRn54S+MkciVZiCWQfjOyyiNgFRmy01M2rnYpFoCPa9TdAeyNtUluo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BY2PR1201MB1096;20:+PBVf3UNuGbrVehz/ss7BWhEauP/Stah+R2OoWf6vUSfkI2GcDxQLGhDHpXK1f+TomSSiKp2WJCzbTXVPFpBttOy9mLr8//y7jfwpMmi+Yz4hAfy3Atr1OwSTCycOVvExK3J+w6UPZrqdYbsIhNUCaLfx0R0SWJrcqMkQfMFPjWR1o/xIci2W7D80f3BaFQBniRAS4Zs0a/yptixq9sPdi264cOvD8s7gbFFRwPKhQVtR7j1IRl/+1aQGucvhxii X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2017 13:34:06.4098 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR1201MB1096 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 9537 Lines: 243 On 2017-08-29 09:12 AM, Himanshu Jha wrote: > kfree on NULL pointer is a no-op and therefore checking is redundant. > > Signed-off-by: Himanshu Jha Reviewed-by: Harry Wentland Harry > --- > drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c | 6 +- > .../gpu/drm/amd/powerplay/hwmgr/processpptables.c | 96 ++++++++-------------- > drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c | 52 ++++-------- > drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 12 +-- > 4 files changed, 56 insertions(+), 110 deletions(-) > > diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c > index bc839ff..9f2c037 100644 > --- a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c > +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c > @@ -1225,10 +1225,8 @@ static int cz_hwmgr_backend_fini(struct pp_hwmgr *hwmgr) > phm_destroy_table(hwmgr, &(hwmgr->power_down_asic)); > phm_destroy_table(hwmgr, &(hwmgr->setup_asic)); > > - if (NULL != hwmgr->dyn_state.vddc_dep_on_dal_pwrl) { > - kfree(hwmgr->dyn_state.vddc_dep_on_dal_pwrl); > - hwmgr->dyn_state.vddc_dep_on_dal_pwrl = NULL; > - } > + kfree(hwmgr->dyn_state.vddc_dep_on_dal_pwrl); > + hwmgr->dyn_state.vddc_dep_on_dal_pwrl = NULL; > > kfree(hwmgr->backend); > hwmgr->backend = NULL; > diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c > index 2716721..a6dbc55 100644 > --- a/drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c > +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c > @@ -1615,85 +1615,53 @@ static int pp_tables_uninitialize(struct pp_hwmgr *hwmgr) > if (hwmgr->chip_id == CHIP_RAVEN) > return 0; > > - if (NULL != hwmgr->dyn_state.vddc_dependency_on_sclk) { > - kfree(hwmgr->dyn_state.vddc_dependency_on_sclk); > - hwmgr->dyn_state.vddc_dependency_on_sclk = NULL; > - } > + kfree(hwmgr->dyn_state.vddc_dependency_on_sclk); > + hwmgr->dyn_state.vddc_dependency_on_sclk = NULL; > > - if (NULL != hwmgr->dyn_state.vddci_dependency_on_mclk) { > - kfree(hwmgr->dyn_state.vddci_dependency_on_mclk); > - hwmgr->dyn_state.vddci_dependency_on_mclk = NULL; > - } > + kfree(hwmgr->dyn_state.vddci_dependency_on_mclk); > + hwmgr->dyn_state.vddci_dependency_on_mclk = NULL; > > - if (NULL != hwmgr->dyn_state.vddc_dependency_on_mclk) { > - kfree(hwmgr->dyn_state.vddc_dependency_on_mclk); > - hwmgr->dyn_state.vddc_dependency_on_mclk = NULL; > - } > + kfree(hwmgr->dyn_state.vddc_dependency_on_mclk); > + hwmgr->dyn_state.vddc_dependency_on_mclk = NULL; > > - if (NULL != hwmgr->dyn_state.mvdd_dependency_on_mclk) { > - kfree(hwmgr->dyn_state.mvdd_dependency_on_mclk); > - hwmgr->dyn_state.mvdd_dependency_on_mclk = NULL; > - } > + kfree(hwmgr->dyn_state.mvdd_dependency_on_mclk); > + hwmgr->dyn_state.mvdd_dependency_on_mclk = NULL; > > - if (NULL != hwmgr->dyn_state.valid_mclk_values) { > - kfree(hwmgr->dyn_state.valid_mclk_values); > - hwmgr->dyn_state.valid_mclk_values = NULL; > - } > + kfree(hwmgr->dyn_state.valid_mclk_values); > + hwmgr->dyn_state.valid_mclk_values = NULL; > > - if (NULL != hwmgr->dyn_state.valid_sclk_values) { > - kfree(hwmgr->dyn_state.valid_sclk_values); > - hwmgr->dyn_state.valid_sclk_values = NULL; > - } > + kfree(hwmgr->dyn_state.valid_sclk_values); > + hwmgr->dyn_state.valid_sclk_values = NULL; > > - if (NULL != hwmgr->dyn_state.cac_leakage_table) { > - kfree(hwmgr->dyn_state.cac_leakage_table); > - hwmgr->dyn_state.cac_leakage_table = NULL; > - } > + kfree(hwmgr->dyn_state.cac_leakage_table); > + hwmgr->dyn_state.cac_leakage_table = NULL; > > - if (NULL != hwmgr->dyn_state.vddc_phase_shed_limits_table) { > - kfree(hwmgr->dyn_state.vddc_phase_shed_limits_table); > - hwmgr->dyn_state.vddc_phase_shed_limits_table = NULL; > - } > + kfree(hwmgr->dyn_state.vddc_phase_shed_limits_table); > + hwmgr->dyn_state.vddc_phase_shed_limits_table = NULL; > > - if (NULL != hwmgr->dyn_state.vce_clock_voltage_dependency_table) { > - kfree(hwmgr->dyn_state.vce_clock_voltage_dependency_table); > - hwmgr->dyn_state.vce_clock_voltage_dependency_table = NULL; > - } > + kfree(hwmgr->dyn_state.vce_clock_voltage_dependency_table); > + hwmgr->dyn_state.vce_clock_voltage_dependency_table = NULL; > > - if (NULL != hwmgr->dyn_state.uvd_clock_voltage_dependency_table) { > - kfree(hwmgr->dyn_state.uvd_clock_voltage_dependency_table); > - hwmgr->dyn_state.uvd_clock_voltage_dependency_table = NULL; > - } > + kfree(hwmgr->dyn_state.uvd_clock_voltage_dependency_table); > + hwmgr->dyn_state.uvd_clock_voltage_dependency_table = NULL; > > - if (NULL != hwmgr->dyn_state.samu_clock_voltage_dependency_table) { > - kfree(hwmgr->dyn_state.samu_clock_voltage_dependency_table); > - hwmgr->dyn_state.samu_clock_voltage_dependency_table = NULL; > - } > + kfree(hwmgr->dyn_state.samu_clock_voltage_dependency_table); > + hwmgr->dyn_state.samu_clock_voltage_dependency_table = NULL; > > - if (NULL != hwmgr->dyn_state.acp_clock_voltage_dependency_table) { > - kfree(hwmgr->dyn_state.acp_clock_voltage_dependency_table); > - hwmgr->dyn_state.acp_clock_voltage_dependency_table = NULL; > - } > + kfree(hwmgr->dyn_state.acp_clock_voltage_dependency_table); > + hwmgr->dyn_state.acp_clock_voltage_dependency_table = NULL; > > - if (NULL != hwmgr->dyn_state.cac_dtp_table) { > - kfree(hwmgr->dyn_state.cac_dtp_table); > - hwmgr->dyn_state.cac_dtp_table = NULL; > - } > + kfree(hwmgr->dyn_state.cac_dtp_table); > + hwmgr->dyn_state.cac_dtp_table = NULL; > > - if (NULL != hwmgr->dyn_state.ppm_parameter_table) { > - kfree(hwmgr->dyn_state.ppm_parameter_table); > - hwmgr->dyn_state.ppm_parameter_table = NULL; > - } > + kfree(hwmgr->dyn_state.ppm_parameter_table); > + hwmgr->dyn_state.ppm_parameter_table = NULL; > > - if (NULL != hwmgr->dyn_state.vdd_gfx_dependency_on_sclk) { > - kfree(hwmgr->dyn_state.vdd_gfx_dependency_on_sclk); > - hwmgr->dyn_state.vdd_gfx_dependency_on_sclk = NULL; > - } > + kfree(hwmgr->dyn_state.vdd_gfx_dependency_on_sclk); > + hwmgr->dyn_state.vdd_gfx_dependency_on_sclk = NULL; > > - if (NULL != hwmgr->dyn_state.vq_budgeting_table) { > - kfree(hwmgr->dyn_state.vq_budgeting_table); > - hwmgr->dyn_state.vq_budgeting_table = NULL; > - } > + kfree(hwmgr->dyn_state.vq_budgeting_table); > + hwmgr->dyn_state.vq_budgeting_table = NULL; > > return 0; > } > diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c > index 2c3e6ba..5547ed3 100644 > --- a/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c > +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c > @@ -640,40 +640,24 @@ static int rv_hwmgr_backend_fini(struct pp_hwmgr *hwmgr) > phm_destroy_table(hwmgr, &(hwmgr->power_down_asic)); > phm_destroy_table(hwmgr, &(hwmgr->setup_asic)); > > - if (pinfo->vdd_dep_on_dcefclk) { > - kfree(pinfo->vdd_dep_on_dcefclk); > - pinfo->vdd_dep_on_dcefclk = NULL; > - } > - if (pinfo->vdd_dep_on_socclk) { > - kfree(pinfo->vdd_dep_on_socclk); > - pinfo->vdd_dep_on_socclk = NULL; > - } > - if (pinfo->vdd_dep_on_fclk) { > - kfree(pinfo->vdd_dep_on_fclk); > - pinfo->vdd_dep_on_fclk = NULL; > - } > - if (pinfo->vdd_dep_on_dispclk) { > - kfree(pinfo->vdd_dep_on_dispclk); > - pinfo->vdd_dep_on_dispclk = NULL; > - } > - if (pinfo->vdd_dep_on_dppclk) { > - kfree(pinfo->vdd_dep_on_dppclk); > - pinfo->vdd_dep_on_dppclk = NULL; > - } > - if (pinfo->vdd_dep_on_phyclk) { > - kfree(pinfo->vdd_dep_on_phyclk); > - pinfo->vdd_dep_on_phyclk = NULL; > - } > - > - if (NULL != hwmgr->dyn_state.vddc_dep_on_dal_pwrl) { > - kfree(hwmgr->dyn_state.vddc_dep_on_dal_pwrl); > - hwmgr->dyn_state.vddc_dep_on_dal_pwrl = NULL; > - } > - > - if (NULL != hwmgr->dyn_state.vq_budgeting_table) { > - kfree(hwmgr->dyn_state.vq_budgeting_table); > - hwmgr->dyn_state.vq_budgeting_table = NULL; > - } > + kfree(pinfo->vdd_dep_on_dcefclk); > + pinfo->vdd_dep_on_dcefclk = NULL; > + kfree(pinfo->vdd_dep_on_socclk); > + pinfo->vdd_dep_on_socclk = NULL; > + kfree(pinfo->vdd_dep_on_fclk); > + pinfo->vdd_dep_on_fclk = NULL; > + kfree(pinfo->vdd_dep_on_dispclk); > + pinfo->vdd_dep_on_dispclk = NULL; > + kfree(pinfo->vdd_dep_on_dppclk); > + pinfo->vdd_dep_on_dppclk = NULL; > + kfree(pinfo->vdd_dep_on_phyclk); > + pinfo->vdd_dep_on_phyclk = NULL; > + > + kfree(hwmgr->dyn_state.vddc_dep_on_dal_pwrl); > + hwmgr->dyn_state.vddc_dep_on_dal_pwrl = NULL; > + > + kfree(hwmgr->dyn_state.vq_budgeting_table); > + hwmgr->dyn_state.vq_budgeting_table = NULL; > > kfree(hwmgr->backend); > hwmgr->backend = NULL; > diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c > index c274323..eb8a3ff 100644 > --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c > +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c > @@ -2282,15 +2282,11 @@ static int smu7_set_private_data_based_on_pptable_v0(struct pp_hwmgr *hwmgr) > > static int smu7_hwmgr_backend_fini(struct pp_hwmgr *hwmgr) > { > - if (NULL != hwmgr->dyn_state.vddc_dep_on_dal_pwrl) { > - kfree(hwmgr->dyn_state.vddc_dep_on_dal_pwrl); > - hwmgr->dyn_state.vddc_dep_on_dal_pwrl = NULL; > - } > + kfree(hwmgr->dyn_state.vddc_dep_on_dal_pwrl); > + hwmgr->dyn_state.vddc_dep_on_dal_pwrl = NULL; > pp_smu7_thermal_fini(hwmgr); > - if (NULL != hwmgr->backend) { > - kfree(hwmgr->backend); > - hwmgr->backend = NULL; > - } > + kfree(hwmgr->backend); > + hwmgr->backend = NULL; > > return 0; > } >