From patchwork Sat Jul 16 14:48:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9233249 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 055BB608A7 for ; Sat, 16 Jul 2016 14:48:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB375212D7 for ; Sat, 16 Jul 2016 14:48:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E04B72223E; Sat, 16 Jul 2016 14:48:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B229223B3 for ; Sat, 16 Jul 2016 14:48:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E33926E163; Sat, 16 Jul 2016 14:48:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.web.de (mout.web.de [212.227.17.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id F28D56E163 for ; Sat, 16 Jul 2016 14:48:34 +0000 (UTC) Received: from [192.168.1.2] ([77.182.189.163]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0LwqJw-1bHwg70rbk-016SqZ; Sat, 16 Jul 2016 16:48:27 +0200 Subject: [PATCH 2/8] drm/amdgpu/powerplay: Delete unnecessary checks before the function call "kfree" To: dri-devel@lists.freedesktop.org, David Airlie , =?UTF-8?Q?Christian_K=c3=b6nig?= , Alex Deucher References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <558FB427.80103@users.sourceforge.net> From: SF Markus Elfring Message-ID: Date: Sat, 16 Jul 2016 16:48:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:VgMWmiylXTfNIYQyQICd+KXLy7Fn7WFPR3ToS3o4N4YbJVjOmuX 9hEpZ3iYMogG1gMouvLElnYqCMaoObsVD3py8KlyxVkw+ZLGfoBgEt7sQKY2IzkzSO1t0EE 1MkMYsdbF+yuFK4OLfceU2rGesw/prZX+0hNW+4CGUtiMfbaKhqJLQgc8YqKidhLB+kDF+C VZWva/+/HrEZlVKM3v26A== X-UI-Out-Filterresults: notjunk:1; V01:K0:Q+yE62jKcyQ=:fb4LKZa2dre8S1hVMvLVhe j4YB7K+mIaNl9PV7cko+7/jiYGClQKHai+HplX3S8U8SXzDDOATR/fmioIRCqRVmTP65Pwl5y 980onxlQzycOqFUtPfEA2AQUCBmfkMBWeZes5K7W3+adT7+O+xq834i23nT4WcepbvrSz4QEW OkB/JnT255ZWEG5JSmK72/aQ4Wd6dXxvU66vGMQdNixWpFRMFvfFK5zfWIEUSnYfl1aIsVZ/Q fwCz94uuKTJAxK8OMpR1mPqZ+NfJqr/IrcH2ZLn8IdwzcLfapYJVjikJ5MmzRkMBpyZ7dkcyp DSrjXiOv0DSxBDBH4/2AtcDOv5+QwX66V6+2Tk2TerNBYVkflyc1wgYfA8E3AaJVS4qlOhps4 JLk375ZdBprtG6fi6Y7MeqSGeBNrsOjlT2/VpiuY7PvvB8SMHr1tdRrJbo064Wj2UGabxfyn/ GWFGSoOpK0vTMe19Jh068QN1esL4/LRB3wq9DqlIqrx2cuc2v0hop1ZRUKNdwcFw9KOCIA1+U d+Rac6GWPPlYNjsROLPTe9MaxwPtLRGhZZLrE7zVf9kAe+SRctYqJI/9AowdQUpB1xmaZEEO7 cKdrNAXnpy3U+hXIGtjmppfCJ74XQgRIjf1A7aE5WeAkVF3OU8+WzUGJ51J7TrTKin4q2IsoI bo4MeQg/6KawFU3rQkhh5GRggoFpxkExv5H1QNbzksnfDyNG5utnAPGPySFFXVqkywiNPZ/g8 rzAivM4PYLkTLImgS8xmWqH0UgNAm7gxyCijM43g7JVnZ6uhdGNvPvPKTR2erQecKPhlivG3i TGD9+OQ Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 16 Jul 2016 12:38:12 +0200 The kfree() function tests whether its argument is NULL and then returns immediately. Thus the test around the calls is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 3 +-- drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c index cf6f49f..6f11bc1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c @@ -1053,8 +1053,7 @@ static int amdgpu_cgs_acpi_eval_object(struct cgs_device *cgs_device, } error: - if (obj != NULL) - kfree(obj); + kfree(obj); kfree((void *)input.pointer); return result; } diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c index 7a705ce..024e22e 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c @@ -76,10 +76,7 @@ int phm_dispatch_table(struct pp_hwmgr *hwmgr, } result = phm_run_table(hwmgr, rt_table, input, output, temp_storage); - - if (NULL != temp_storage) - kfree(temp_storage); - + kfree(temp_storage); return result; }