From patchwork Wed Jul 13 18:01:27 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: 9228335 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 B4F9060572 for ; Wed, 13 Jul 2016 18:01:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA18927165 for ; Wed, 13 Jul 2016 18:01:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E46027F8E; Wed, 13 Jul 2016 18:01:36 +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 4BBE627165 for ; Wed, 13 Jul 2016 18:01:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ADD236E7AA; Wed, 13 Jul 2016 18:01:34 +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.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id B4D6B6E7AA for ; Wed, 13 Jul 2016 18:01:32 +0000 (UTC) Received: from [192.168.1.2] ([78.53.182.169]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0Lmchn-1anmfr3CtP-00aCBG; Wed, 13 Jul 2016 20:01:28 +0200 Subject: [PATCH 2/3] drm/msm: Delete unnecessary checks before drm_gem_object_unreference_unlocked() To: David Airlie , Rob Clark , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org 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> <351a1279-b0ca-5f5e-d175-28c9de8406f6@users.sourceforge.net> From: SF Markus Elfring Message-ID: <9120ad90-45d1-1c01-fc84-65c431b5ca4f@users.sourceforge.net> Date: Wed, 13 Jul 2016 20:01:27 +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: <351a1279-b0ca-5f5e-d175-28c9de8406f6@users.sourceforge.net> X-Provags-ID: V03:K0:InFHhA2/JCJQXTj0GpCegNiPgInyC/by44zqxsfqYYPawudLIAc o5FHd5Mj27UW+O4hT08spaXiCwnpLUe16BnuWGRvGGwryX2k2ecXwIH+wK8RSoIxOEcTSnE lkxyFysmRyI2e1Yy1skQJdQ24EavBBXUKbfEjf30F7jLz9q/nradxrzUOfZPmj982NJfsdk s6kFnVJbtei2eYERg2UdA== X-UI-Out-Filterresults: notjunk:1; V01:K0:tUhJXIvQkAE=:rQUtGfCt2DaMLgu77DkH5C Q4V6Hn/03NdndEvGCMKY7lbZmqVXmbzH0JI2t5RZ77N1fpMY/905xpbWSOo0N5HfOy5bfNLpg MA1ePhtdCZEDOOgAbgvMNq/qie2X6zH/u3oxrhghhqYys2gJuAoSCOcbIOTPWzKSv+X4hcSFC 5Q5WdPTwe073twf6bYmoJfijd2Hr+iTOK1goUpijGrbD2OIrcUtmnqgz6/fbgy7NZM50tyXSM qEroseiQt9hsXke/dKgWHHER7XEdRQuyRkaRL0yEi9nI+8zWzjSM8csaUSmMx9fIKijFcVGqb wrg1vyvG69+1RQq/npSntjX9miwq4WFWJ3eHkvzl2n2/VM/YnN4WVyl1KfgTgfkdjQqsI9szx QLqpDeiGum+I+pPacaohCkHQAH9ctEgrJRPNciPP9jHHu5G87STd2VD4wYGJNZWCUl24PwSfL yf4zH8KaE6ruQX8bYgUAvvhcVXC5HKmIc9Mjx9wGTO9rXiTVe/tmUlYTpty8rE692qstZtyGQ h4KSbtk0zCWkEPdwx30+qLZeBWKM0uKoyDVtYVJN1RVkEDV3EjHPiJDlXquv/EQtqBW8DPlsg m7htLMquqtCugMlE6PS/SOyrXYDfmhPoq4C0FaBxdyHzyM0l2VKJf5pmXDQQ5ugpX+aejD19t fgro1OGzgp61o1h+DZ08KCgQ6huHDDajP/EZXA0hhNVaZjbuWBuIkXTQ0+3eFLwN324yXI7PB cQoFHOF5kJemxOfGziyXNxvY4MOiUX1GVhOqKizsIpIgUHq2XTcCCAzsvJSPgdQieRQfhy9NF adhXC9X 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: Wed, 13 Jul 2016 19:15:35 +0200 The drm_gem_object_unreference_unlocked() 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/msm/mdp/mdp4/mdp4_kms.c | 3 +-- drivers/gpu/drm/msm/msm_fb.c | 4 ++-- drivers/gpu/drm/msm/msm_gem.c | 4 +--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c index ba8df15..7b39e89 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c @@ -168,8 +168,7 @@ static void mdp4_destroy(struct msm_kms *kms) if (mdp4_kms->blank_cursor_iova) msm_gem_put_iova(mdp4_kms->blank_cursor_bo, mdp4_kms->id); - if (mdp4_kms->blank_cursor_bo) - drm_gem_object_unreference_unlocked(mdp4_kms->blank_cursor_bo); + drm_gem_object_unreference_unlocked(mdp4_kms->blank_cursor_bo); if (mdp4_kms->rpm_enabled) pm_runtime_disable(dev); diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c index 7919c24..95cf8fe 100644 --- a/drivers/gpu/drm/msm/msm_fb.c +++ b/drivers/gpu/drm/msm/msm_fb.c @@ -49,8 +49,8 @@ static void msm_framebuffer_destroy(struct drm_framebuffer *fb) for (i = 0; i < n; i++) { struct drm_gem_object *bo = msm_fb->planes[i]; - if (bo) - drm_gem_object_unreference_unlocked(bo); + + drm_gem_object_unreference_unlocked(bo); } kfree(msm_fb); diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index 886cfe0..9a713fb 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -875,8 +875,6 @@ struct drm_gem_object *msm_gem_import(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); }