From patchwork Sat Jul 16 14:45:17 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: 9233243 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 946B060574 for ; Sat, 16 Jul 2016 14:45:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8442820072 for ; Sat, 16 Jul 2016 14:45:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 76A4F20951; Sat, 16 Jul 2016 14:45:39 +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 43CCA20072 for ; Sat, 16 Jul 2016 14:45:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1A976E2BD; Sat, 16 Jul 2016 14:45:35 +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.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1BE0B6E2BD for ; Sat, 16 Jul 2016 14:45:32 +0000 (UTC) Received: from [192.168.1.2] ([77.182.189.163]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0MJkxE-1bPXIu0NNM-001CZj; Sat, 16 Jul 2016 16:45:24 +0200 Subject: [PATCH 1/8] drm/amdgpu: Delete an unnecessary check before drm_gem_object_unreference_unlocked() 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: <6d43d27d-a55b-ddeb-76d6-3e2493786b12@users.sourceforge.net> Date: Sat, 16 Jul 2016 16:45:17 +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:9ggPGUXkU3gFvLtmQ9hNJW6w0SYLsiSQm47ZWHmsSB8ZmzJCaK0 akEJpjOU6drPuLQKVff6SMdPmzoBJo5mvFop1OO6/UPL8QqHJ64yZvzpslzAaKr8glSCqFz nQ1tlZOQiG5No2nGJxBN3BcOhnhdddvM9NPAyZm40iHMvcrb0RsnksoqUfV+Mvtk4+7NsCb 024gMGmdvMtyclCjcQPLQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:k3gf124GKQE=:RI15JxQ1/Q3gt+aoXqfRec RGwGhFM1JLOssHvepd4LH0GakVof8RXcLy5ti/6IpBbuhN+DqFzTQLsYrHDmJ/mOYogjKwuN1 l3CA/67IVLHxymp/oASX0d19SLS03Z/OieibTLkpxAlnMiAcjtqu7R0n9IxE9KJFyH34F80H/ peqFf3mGK2O0xsMRteuQu2rF2TlPxMks9ZQLFJ/j3oO3vyggeXOgLacY02p2fpr3N//tlQWS1 45beHlU7meFJIGlx1kl7Vur9+Aa4gXRFFLGJME8ugwCbfsZunKTGvIo5DlIVuSb6xWWKohxSn hgDaVcVYI0GKB/oQLIKQdy7SHItqUSqKCVaj4LkQNOp1Ira2a6WwcbvrX/pYiDEvMA9af6IiK 1sNi0hK1hetGRZGgrBBY9p0HbJiipLOa1Zti38bFSWPpEUVZ8ZDIIahIipLd6qUJK0ZTDTh8T RZt1Azuwi3shS6O6KPjgxlqoGaIJ9br+rQhoBFveYeSe4F/8oh61MOIEaBYQlzZkQMQzl9bZy P5QbvbuUk3jZtsZPD9rBfD1zyWQJDXiom8nebYPldsSZjC7SsS0sCwb1tnFpxQvMEa0tePnel xMEU9TH85YgC+VHUSZtVgzsIfZLvjU05uMJZ6k2hqb11JwvfUODqWPi7rJYn5o7SqyeFD54e7 zCdo5soScetVlUSANrCHlfORpshB4oc8ogIzTtB7u0m7jFwgdbYLrHNI5ydhrArtkpF4oe0Q2 S4wZ2wejbAOyZA+LMa4OHt60eO6NKzRvNi23WNqcrN5B8n8IIAIDSDiTXHWxCZh5ZcgtZQkIA r5Bnhhb 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 11:28:36 +0200 The drm_gem_object_unreference_unlocked() 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_display.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index a6eecf6..2a07b15 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -516,9 +516,7 @@ static void amdgpu_user_framebuffer_destroy(struct drm_framebuffer *fb) { struct amdgpu_framebuffer *amdgpu_fb = to_amdgpu_framebuffer(fb); - if (amdgpu_fb->obj) { - drm_gem_object_unreference_unlocked(amdgpu_fb->obj); - } + drm_gem_object_unreference_unlocked(amdgpu_fb->obj); drm_framebuffer_cleanup(fb); kfree(amdgpu_fb); }