From patchwork Fri Jul 22 15:47:10 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: 9243803 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 399C160756 for ; Fri, 22 Jul 2016 15:47:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B62C26246 for ; Fri, 22 Jul 2016 15:47:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 203C527FA7; Fri, 22 Jul 2016 15:47:32 +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 B29DB26246 for ; Fri, 22 Jul 2016 15:47:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8114C6EBF0; Fri, 22 Jul 2016 15:47:28 +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.4]) by gabe.freedesktop.org (Postfix) with ESMTPS id 218566EBEF for ; Fri, 22 Jul 2016 15:47:24 +0000 (UTC) Received: from [192.168.1.2] ([77.182.75.73]) by smtp.web.de (mrweb002) with ESMTPSA (Nemesis) id 0LhNaa-1aw0xM1CMq-00mXOj; Fri, 22 Jul 2016 17:47:12 +0200 Subject: [PATCH 1/4] GPU-DRM-Etnaviv: Delete unnecessary checks before two function calls To: dri-devel@lists.freedesktop.org, Christian Gmeiner , David Airlie , Lucas Stach , Russell King 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> <00ca5af9-674a-73ce-b423-1ce41d426942@users.sourceforge.net> From: SF Markus Elfring Message-ID: <9638cd74-ffc5-d9ee-a40c-9b60e860ad8b@users.sourceforge.net> Date: Fri, 22 Jul 2016 17:47:10 +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: <00ca5af9-674a-73ce-b423-1ce41d426942@users.sourceforge.net> X-Provags-ID: V03:K0:AJ4yxX/Io/YBtjw4yr2fqnCtDJu8ZuzdBiS6/om19uC2s8LRs7A ji+UxZA6/RSHl473MPjTm24u53yQaFy6RYpU0V/b4kO1JNUBqdUkMieBw7tR8eYhidFebKo wjQiuYUbntEZqcPzQxqx9DJklJsieHFIFST+QXU+D/YoOe/Rteq9MFCY5KQgdg5Rz2dhUbC 1/KhyEk+HupqiIhB7DEMA== X-UI-Out-Filterresults: notjunk:1; V01:K0:jaZiD57Rzn8=:huyURQaZ6FOB7v7S1+L96T HBw4TfY2A9ynP2XzaZlJiLSXJygCnq2Jd1Em0NsM/inOIMCMOnhOYgK6UzVIbyCPJsbQGYSRA /p/N7Q/ggndC9W1BZBKQGoNKW6jZWZFOWF8Ofr3cW8hSVq/hA88hHYW57dFSZxAfnFQmNnxMA S9n73LPvCG85VbrJChDMK5hdNR4JAYPOSBB6++8u/Zcz+JUDEGlFNYZ46E75g0o8XoOZiFYWr 5kZMGOW931ZiXuGTAiIAKK5U/Duza2FNB8usPOHqOBSLeJZIMg7G5UKt8HXO7zuiZE5RVwnrr kbfhgn3gnUYyz5WL/4oZc5rIoGtJK8m8sCoKwLNLqxK7NA08tbaOJ3G4v9qV4F0pIc+2JVyHs 3wPmdjnsWtFl09cR3avFtvor86Vsu4lrCAAznhDwio1WiaasfuzLRLfuU2jtUMrGm6vQIGZIk XvsHPLv6OwBWSwpV4fGCyiw9f3XhRATeYJePGUDZ9L8zGhvDAfHL/vuCPIgln+trEvLfRFNzC 1HKS7zdJQ501U3jDnOI48l0vM53h1DK44EdljiXAl6E4tY3zPU8X3tHNDpbi+6fFT6mfYdWOC NkqBWkRv49qpBZaJnLaq9KnLGevPWD+GtGy6QDAxqDVst4ReIRWaYrNlvZS0nPDCe+7ZUm2uJ i+E7a6lr9ljJT//Yee4wGopY5KnnwPtC/mU+fpKJM1OpOHjvmuZLiIcMOSaBT5jaLjItmq/lQ xJGj9D93qBpRHSbthtwIS4T/aXm52VqONxt+sPTepwhlaoPvv9MvD6FpmtIRSup5XLmaxIePP zbpp5OK 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: Fri, 22 Jul 2016 15:56:15 +0200 The functions drm_gem_object_unreference_unlocked() and vunmap() perform also input parameter validation. Thus the tests around their calls are not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c index 8c6f750..8eee742 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c @@ -535,8 +535,7 @@ void etnaviv_gem_describe_objects(struct etnaviv_drm_private *priv, static void etnaviv_gem_shmem_release(struct etnaviv_gem_object *etnaviv_obj) { - if (etnaviv_obj->vaddr) - vunmap(etnaviv_obj->vaddr); + vunmap(etnaviv_obj->vaddr); put_pages(etnaviv_obj); } @@ -670,9 +669,7 @@ static struct drm_gem_object *__etnaviv_gem_new(struct drm_device *dev, return obj; fail: - if (obj) - drm_gem_object_unreference_unlocked(obj); - + drm_gem_object_unreference_unlocked(obj); return ERR_PTR(ret); }