From patchwork Wed Feb 4 21:25:48 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: 5780471 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 E32CC9F2ED for ; Thu, 5 Feb 2015 00:46:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 14414202E5 for ; Thu, 5 Feb 2015 00:46:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7B1F5202AE for ; Thu, 5 Feb 2015 00:46:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EA9156E1D3; Wed, 4 Feb 2015 16:46:32 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 305 seconds by postgrey-1.34 at gabe; Wed, 04 Feb 2015 13:30:59 PST Received: from mout.web.de (mout.web.de [212.227.17.11]) by gabe.freedesktop.org (Postfix) with ESMTP id 64F026E707 for ; Wed, 4 Feb 2015 13:30:59 -0800 (PST) Received: from [192.168.1.2] ([92.228.139.27]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0LmLgE-1XjETP1NLO-00Zvze; Wed, 04 Feb 2015 22:25:49 +0100 Message-ID: <54D28E5C.9040304@users.sourceforge.net> Date: Wed, 04 Feb 2015 22:25:48 +0100 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: David Airlie , dri-devel@lists.freedesktop.org Subject: [PATCH] GPU-DRM-OMAP: Delete unnecessary checks before two function calls 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:YGbeHqHmzZ62Sf6Tini5xSyXquNAlBZEms/sKXiYq9mX83wrqLd Fnt5X6KK/gdfLLJsQzTa0IIR6xIoTxXbMTiAXDDnICd3GXNRIrF8WpOoDXVloUPDWNnl3r7 4d2cv0Ps1nmjJhFq5vKti+Mrarc/Cmf172g34LHAFgdHqyRdIMh9soVn30hCkpK0qvzCVWZ OKWiPHVnZ9v8HsUF9P43g== X-UI-Out-Filterresults: notjunk:1; X-Mailman-Approved-At: Wed, 04 Feb 2015 16:46:32 -0800 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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: Wed, 4 Feb 2015 22:22:36 +0100 The functions framebuffer_release() and vunmap() perform also input parameter validation. Thus the test around their calls is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 +-- drivers/gpu/drm/omapdrm/omap_gem.c | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c index d292d24..fcc02b0 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c @@ -270,8 +270,7 @@ fail_unlock: fail: if (ret) { - if (fbi) - framebuffer_release(fbi); + framebuffer_release(fbi); if (fb) { drm_framebuffer_unregister_private(fb); drm_framebuffer_remove(fb); diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index aeb91ed..18a4137 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c @@ -1292,12 +1292,11 @@ void omap_gem_free_object(struct drm_gem_object *obj) if (omap_obj->pages) omap_gem_detach_pages(obj); - if (!is_shmem(obj)) { + if (!is_shmem(obj)) dma_free_writecombine(dev->dev, obj->size, omap_obj->vaddr, omap_obj->paddr); - } else if (omap_obj->vaddr) { + else vunmap(omap_obj->vaddr); - } } /* don't free externally allocated syncobj */