Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753839AbdH2N2Y (ORCPT ); Tue, 29 Aug 2017 09:28:24 -0400 Received: from mail-by2nam01on0085.outbound.protection.outlook.com ([104.47.34.85]:55744 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752942AbdH2N2X (ORCPT ); Tue, 29 Aug 2017 09:28:23 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Christian.Koenig@amd.com; Subject: Re: [PATCH] drm/amd: Remove null check before kfree To: Himanshu Jha , airlied@linux.ie Cc: alexander.deucher@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <1504012887-15147-1-git-send-email-himanshujha199640@gmail.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: Date: Tue, 29 Aug 2017 15:28:10 +0200 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: <1504012887-15147-1-git-send-email-himanshujha199640@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [2a02:908:1251:7981:96b:bf6a:ea5f:9e6c] X-ClientProxiedBy: DB6PR02CA0033.eurprd02.prod.outlook.com (10.170.218.174) To DM5PR12MB1308.namprd12.prod.outlook.com (10.168.238.7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f6610dbb-bf2a-49e8-d840-08d4eee1d12f 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:DM5PR12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FsrZeli0T2Jghdctllj3v/JydxqipJowbnXKYp8U3vsAHZqy+zRw/C66w3qOncBRqOiMHufTj2/r7aIYyVEDz0hG5FgUDrK1z1iBujdzuLT5rljnhhPNLTVTbmD3UOYTOkDd4Zm2uS0LbusoIiMUv5msA/OfSOrALtTAcEgiby8wuFz4y8/5s5w++iEHQPqtDTayoM/aaC1mfxy4L3lUv5FizjWI0fHN9L6ea5hAk6UGbP4+BIcepBeJiUOQvKw3cuq5+DXrDuEGYjFzhp2h0i3Z2VwnOjnnzeX7rQ2P/nKN8E5kAPgTCx8d37wxJqY1j2ZXca5IgpUxE0XrQwmyZv8krrOrKA4ZSJpZBEhVs+pk6Hz2JquEo8cfAfSoWMXCsgNKqFCbek;4:tRL27v5T2pHLwvtxhJ0mN6r410fnfmO6pz/gANj2hF72lga8hXq/2vZrOqaIidRs1+7NVNtSJZEOCbJ8RmW6N289y4x1sh0GrglwM/4gS6uFz7b6QmvuyWO2GBAkkSgWvtZNajzpTnVuyvb78STJsTHdXjNIT7RupyvsDDZT1Cb3g6GQ3brAY3qyXbQSdnrYwa33wrDQ/hxIKY0umziQoApx9blspx/rFdoEs4rnYBeh0CtH7MuiypDnXS3txVvJgsKVbze5u057IreRNg0zvYnpDn2EO8gt2irYUTUnAJo= 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)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041248)(20161123562025)(20161123558100)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DM5PR12MB1308;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM5PR12MB1308; X-Forefront-PRVS: 0414DF926F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(7370300001)(6009001)(39860400002)(189002)(199003)(6246003)(110136004)(4001350100001)(72206003)(36756003)(31696002)(86362001)(97736004)(478600001)(64126003)(68736007)(50466002)(4326008)(8676002)(53936002)(47776003)(65806001)(25786009)(7736002)(305945005)(81156014)(65826007)(81166006)(6666003)(6116002)(229853002)(1706002)(50986999)(2950100002)(76176999)(54356999)(42186005)(5660300001)(31686004)(65956001)(7350300001)(105586002)(2906002)(101416001)(33646002)(6486002)(189998001)(106356001)(23676002)(83506001)(2870700001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR12MB1308;H:[IPv6:2a02:908:1251:7981:96b:bf6a:ea5f:9e6c];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjEyTUIxMzA4OzIzOnFIOHczcU9lMDhia2hQMzBxNzJiMjQxemdW?= =?utf-8?B?ekVBWm02UFhZMWFCSklMUTlDV0dQSWw4QVEvYUhQZEhacmxzdTcrdVF6MVBF?= =?utf-8?B?RnBVam8yVGNmM1VwM1BHU0EyOHdWL29aQXVlbEVrTzcxclN3Qm1SaUwvWUph?= =?utf-8?B?Q2hZNjNhZDdZWDBYMlNHa3RVcG1hNk5ZNHhUWTV0a3d5cVBMUVE0TENjY21l?= =?utf-8?B?MWN5czNueDVGaExoZ3VDdUwyN0lBUFF6ODUzdXBnczBZQXdodStjcmZMUC9v?= =?utf-8?B?UnJNRW1Gbkd3djJ4dWJ4aXFYanlZdVJTVjdKZjh3SXFtQnFOdlI1WW5Oc3Fi?= =?utf-8?B?TjJMc3BiZ3FOT3cyeVN4blhaa3lhdVkvbU56ZmtKZlpvMEkvRDNHTDQ3Ti9O?= =?utf-8?B?ZWx5RmQxTUJ0K3llbFd3YUJsaGxuZjdi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1VC6RGQzNIztdc=;7:jCb2VVxEt7jQ8m3AoiFiJ1xuXKaGC43xjU54w5zGBtIcGhsuwRxd2Qqb3izCWPbfmeo3IrbDvkFwcEVbjHe06aR8S+5tmYTaooq7evJiTXPlQYKMOqSmpzQyA6tgJDi10FD17zIbRXHqGvd1KfastRKG6jjK4pmCi1vEYRvsHcl8Afyv9wutGNi8WN4v4ScZJqRTrwsuxlgMKD+W8mzwcIz/NyIsHRk6jOLeV25irW4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM5PR12MB1308;20:mSGLOkqsXLUW051bu5thoDpnFUGgoTPlPpobgxlTW1cf+r7n+GvJGIizo2xKuA5ewTV98a33SHVOo7UOA5N9xhhlhWm2UZqBRojnJrhD8owvqBt3PQvcMt2wwgZKzgdhByidLqu8rtvmCbR5731Mh6sG6F062yTURMEPbNzifiGDoIISeqzKfLEc73aH5QSjk3+4VM5qANbdRL2BEdZrhqY/0PXeI6WvDiYDWEtlyJwLR9byyBUnahBzLt1A+EXu X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2017 13:28:19.7895 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1308 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1760 Lines: 47 Am 29.08.2017 um 15:21 schrieb Himanshu Jha: > Kfree on NULL pointer is a no-op and therefore checking is redundant. > > Signed-off-by: Himanshu Jha Reviewed-by: Christian König > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 6 ++---- > drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c | 6 ++---- > 2 files changed, 4 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c > index 8d1cf2d..f51b41f 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c > @@ -346,10 +346,8 @@ static void amdgpu_connector_free_edid(struct drm_connector *connector) > { > struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector); > > - if (amdgpu_connector->edid) { > - kfree(amdgpu_connector->edid); > - amdgpu_connector->edid = NULL; > - } > + kfree(amdgpu_connector->edid); > + amdgpu_connector->edid = NULL; > } > > static int amdgpu_connector_ddc_get_modes(struct drm_connector *connector) > diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c > index 76347ff..00075c2 100644 > --- a/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c > +++ b/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c > @@ -606,10 +606,8 @@ int smu7_init(struct pp_smumgr *smumgr) > > int smu7_smu_fini(struct pp_smumgr *smumgr) > { > - if (smumgr->backend) { > - kfree(smumgr->backend); > - smumgr->backend = NULL; > - } > + kfree(smumgr->backend); > + smumgr->backend = NULL; > cgs_rel_firmware(smumgr->device, CGS_UCODE_ID_SMU); > return 0; > }