From patchwork Sun Jun 28 08:45:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 6686531 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 057089F1C1 for ; Sun, 28 Jun 2015 17:10:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2BD27205DA for ; Sun, 28 Jun 2015 17:10:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4C75C205DC for ; Sun, 28 Jun 2015 17:10:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 904D96E232; Sun, 28 Jun 2015 10:10:41 -0700 (PDT) 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 C54366E027 for ; Sun, 28 Jun 2015 01:45:43 -0700 (PDT) Received: from [192.168.1.2] ([78.49.227.64]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0LdW7q-1Yi0va182E-00ikcA; Sun, 28 Jun 2015 10:45:36 +0200 Message-ID: <558FB427.80103@users.sourceforge.net> Date: Sun, 28 Jun 2015 10:45:27 +0200 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Alex Deucher , David Airlie , dri-devel@lists.freedesktop.org Subject: [PATCH] drm/amdgpu: Delete an unnecessary check before the function call "kfree" 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> In-Reply-To: <5317A59D.4@users.sourceforge.net> X-Provags-ID: V03:K0:eI2c7Xq42Nh+QL9AuUnS+aSLB30ZkNvJrRc+aFM0joflUZ2DHFC Xl2sjBA6ucteJtR8PexenZYCc41Kl38MsjNE5HmN9fznZkDIeSeXaWXqn6NZp0Peh4hyNzd /Sugv33jzKr75ha8Ogy44hXs7QAflvfR7vTb86fbyyBHCwwXIyppnzxS7I/IuaHoL5CJubm fZw9s3yT4oIoGANPxaIzQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:C7CE34JXaiM=:s+rPaSeZd1MiyKwDTio5Vg jIQlFi+RZ0Hjo3sCMCC2I82+s3cuxvcxdToVWJG2HiKjvj9vY064eKwNjGIm6DA8cBTwd7gro hKkcpqqJrjAmJcgwdTBUkjs/mKBgiftkaHPdydNwp9kkSyCgDv4Zp8OoMYHDtBPgb1eh40DIU 3a0zVowRpEBWNEgyRuCJAnIMFkQGhyo3PiTKylcLK60qAuxyabR2T13e+Fc42vM0qUf2Tq3Ai u9QjBaEwA5T4afQAuJTm4plDnBrHD+WYxOAEBUgyojzC9WXWrx5FyT8DE5oLVh1O/5qml3iKK qYQWUWWIMsBQyO1ft3uPPpzY3wggJwaYnopvMR/2276k3ASrM+eb5sY/OmOr38eHaLq1V6S3s P5DlH1DRtEH2CbCvIQ4rqJHAt5SmVWMg3vT/pdxGa89/dAXgbB7rK8q/FT29j0RAvgyQzJBx7 QyxJUxFfcr9UUQhXdYTIUhcOj3NdWqhczckJovRmjecDkTcYY6CIu6ugQCduaP6c7CIppniD7 O+GxIQV1pamX+i+AyNNj6F5T8/YMoNLSg5aMslUt8L8cfFlOQhuOJJ6nyiPRmezS5W7dQU8iz VWjORhVl9CKS7kTUwK+qMAjg8SUY3HzvZYiB/s2XCWB3+FEaLH4QhRBwIKYgrEwjqjz3keVJX zk+t94z62bDb71IFVe7F8p6XQcfg7aTAvtCeI+Mr7SpW6q5wGCbL/XieeO4Ddp25IVX0= X-Mailman-Approved-At: Sun, 28 Jun 2015 10:10:39 -0700 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-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 28 Jun 2015 10:27:35 +0200 The kfree() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index fec487d..a85cd08 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -1575,8 +1575,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev) amdgpu_fence_driver_fini(adev); amdgpu_fbdev_fini(adev); r = amdgpu_fini(adev); - if (adev->ip_block_enabled) - kfree(adev->ip_block_enabled); + kfree(adev->ip_block_enabled); adev->ip_block_enabled = NULL; adev->accel_working = false; /* free i2c buses */