From patchwork Sat Jul 16 08:04:34 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: 9233049 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 B2F5760865 for ; Sat, 16 Jul 2016 08:04:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A29922638 for ; Sat, 16 Jul 2016 08:04:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D4CD24B5E; Sat, 16 Jul 2016 08:04:53 +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 2FE8A22638 for ; Sat, 16 Jul 2016 08:04:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 57E326E14B; Sat, 16 Jul 2016 08:04:47 +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.15.3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 92E296E14B for ; Sat, 16 Jul 2016 08:04:44 +0000 (UTC) Received: from [192.168.1.2] ([77.182.189.163]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0MJTHn-1bMOeC1Z6J-0039wf; Sat, 16 Jul 2016 10:04:39 +0200 Subject: [PATCH] drm/ast: Delete an unnecessary check before drm_gem_object_unreference_unlocked() 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> To: dri-devel@lists.freedesktop.org, David Airlie From: SF Markus Elfring Message-ID: Date: Sat, 16 Jul 2016 10:04:34 +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: <5317A59D.4@users.sourceforge.net> X-Provags-ID: V03:K0:x029uQDp2pkNjVKQYV8IRr0Hl3OCjrCRV3oBVj6mFOzAOdGL542 3gstGg87+CocE9pz/x9m1agECe6V8njxGE+seD5lYlcU1jkVrkshhxH2uNHpQ9rBGI46LIT ZoR1RxhdPi1t0pjeZr2pWf/JaBP2gvww6SiF7CtK9XMvdSH19ZLZG0JAsXSOCzMN+Ko/qlA gJVmy4gVXOC8bF2MvlP+Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:nGbr11sczTI=:XpyKMnnK/F6FCJQkLBsRys 78gK5JgTQjmD2yOda/3hqMKnHRIRrFPAQMcfA1QHDPbVfX58HnkHYFouZVLMcoDd+MWxzvBz/ mLXxo3r3meJ9YlAJNMEficEmlaGwemzzZSPsFd0pC//AiCnQLnFoSGSBRrlTNtsBKYhiqaXei ERjNXFoRKJgpSdbq5Sj+S3vSSKue9sEqfcb3tbPNE+WP6VyIczriBlwIJPwsuxx9T04hy5Wlc J97Wq+be13SYd4OTSk5vq8qZkkszps8tKQ3TEqIJTzbDfX+gz1ZG2O0mz0VWb0EGwXNknAadi IGcVN3pq6G35lInWK9n/GypGMQCYGrnNrAhpYG54/o3cg9NWwRyvEUG+ke8COSwIsM7EU4Bez duQIImx0Lagl0bHFB9cBA1P/9XtujXHO8RL4Iug6AqCFODeDu0bYHPS4/+IoNEf8TlujnC1rb VQeAMz5LhlWTOIN5x463NXR3Jj6SNaycDd9bNJZCB8+6ka+N4BtgZsgS02304QL94rJmdfrSL 2IJXSxov6PLqq9Ub/EWxiDuBuUglXQj46H0QoamFm/GbnCQjen1x5f8sP7RWqfUcgyvOkKMX2 8skJ56hJq+F6mrOiPlrYMHP3U116LrpaK6qomxF0eBRo/4aIY2/3N+mM8cBA1xqd6LLd4ozc8 4kV+/rG+Bodm3h7ISSv0AmQ055751HCzy+0nYCNvs4TstSmqewkeBupXqL2c4BIP5Os5KVYr4 37Z8dNHnGhqLOQvdK6wfIJgFf5Gvr4P8uFzpgvdc6saavoHA5ANgUY1gY+ZIAA2JVASQ2wX5i 9i3mmiS 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 09:54:22 +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/ast/ast_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c index 7bc3aa6..904beaa 100644 --- a/drivers/gpu/drm/ast/ast_main.c +++ b/drivers/gpu/drm/ast/ast_main.c @@ -295,9 +295,8 @@ static int ast_get_dram_info(struct drm_device *dev) static void ast_user_framebuffer_destroy(struct drm_framebuffer *fb) { struct ast_framebuffer *ast_fb = to_ast_framebuffer(fb); - if (ast_fb->obj) - drm_gem_object_unreference_unlocked(ast_fb->obj); + drm_gem_object_unreference_unlocked(ast_fb->obj); drm_framebuffer_cleanup(fb); kfree(fb); }