From patchwork Fri Jul 22 06:45:23 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: 9243047 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 B944F60756 for ; Fri, 22 Jul 2016 06:45:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B02027D8D for ; Fri, 22 Jul 2016 06:45:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8953B24B5E; Fri, 22 Jul 2016 06:45:44 +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 1F2F224B5E for ; Fri, 22 Jul 2016 06:45:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EB5AD6EAA5; Fri, 22 Jul 2016 06:45:38 +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 E9FAB6EAA5 for ; Fri, 22 Jul 2016 06:45:35 +0000 (UTC) Received: from [192.168.1.2] ([77.182.75.73]) by smtp.web.de (mrweb002) with ESMTPSA (Nemesis) id 0LqUG9-1amUdA32q9-00e2kx; Fri, 22 Jul 2016 08:45:25 +0200 Subject: [PATCH] GPU-DRM-OMAP: Delete unnecessary checks before two function calls To: dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie , Laurent Pinchart , Tomi Valkeinen 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> <54D28E5C.9040304@users.sourceforge.net> From: SF Markus Elfring Message-ID: <72ff4670-4f3d-c7ed-4f37-e49f2bbc7aba@users.sourceforge.net> Date: Fri, 22 Jul 2016 08:45:23 +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: <54D28E5C.9040304@users.sourceforge.net> X-Provags-ID: V03:K0:SsJ0poa4D55mnw1oBhZQrBzkjmru+viBtOsYC/82TCXL+J9Sy15 UXOcp6/ZHEPh6uAzTQdnO8mbk1spE0fq3H+E1DZNq+NkqkEMcgKZnjWJiEiYbtM1pvKlpF0 8rVrstZDp0K2eTLadh5DQNN3ovP1TpcSgqeZn3XVL/eR1sosyAk0JMZKh28voKt2YJ8g51d JI72TLzPHUvs6OzBZ8e1A== X-UI-Out-Filterresults: notjunk:1; V01:K0:5b/wDDfnFkk=:nx17YzqikCjVtbpJtau4GV e+02eo/D7rNs2+hwzKSjVJsB6phONDhzUjkuEMoU1NJCTM7lKanJZ5c4TeElFjw9QTL/aUMy/ FXDr+ZpBOn7yOYPAt1pD1H+yRXcf98wf3myncKHGG0Xoz6GVrwdGGrq8bVTlkH/kaW5eWnVqI jLt2SImk/cAYp///IYHlb5dOoJ8va2BNu18NPsoxpZeSR2aCySnMnYmrsg1WYI8L2jSQK8rML 42zqYtdOloTNZtMjV8Y5xQDtHiYbUjRj8k9dt8favz4XeeEAuCHnpg6r+EKjHJx4zJQl9ZAcE L/XN1zSwWRRdr74onJ2k0BPe3HnWKueOhbO2FRoqKDeef8DJHj9NRLoeXDnfOgpk3kWOs4Vr1 1w0r2BcBlDhQPsZC+ZcWq4XXEJv1pwthO2S5YbeJpeWW4AFm/fJmDHWlVHQ8OM40qry2oTiG0 RFOZ/AF/YEKZaUjgib8yBGSiW5qLDflpGmrvN4taMIEl2DofHniW2wlgrDgeekyp3luBFxOfh j5xxt1IetD3MDRxorvRZpeJZelTJAaEEYwBjMvO/xSIifAUtu97AyXrEa0BGIqRuFQXkiWc08 WyCzdtUl9KCcXHl4aGfwCQS+i0Cep4Z0OMF1ytb+FuxsyQr6FuSUDphm/Dhkuvp9m8nK6YQah n4qZmIux6dAznb28gjvQ6w7iXGTZjKcvfMTFoIrfzf6BrvJicIWfHIWgnS6xkFsaXgmFjocBU j513y34qjk+Mj+nt+f5AE6NrciBH1khkEJ1iA8wXlec0Gw7GkRXrs+FhDVHy3DP9nOCDQfPdG bWyNJ7l 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 08:28:31 +0200 The following functions test whether their argument is NULL and then return immediately. * backlight_device_unregister * drm_gem_object_unreference_unlocked 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/omapdrm/displays/panel-dsi-cm.c | 3 +-- drivers/gpu/drm/omapdrm/omap_fb.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c index 1b0cf2d..0eae8af 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c @@ -1284,8 +1284,7 @@ static int dsicm_probe(struct platform_device *pdev) return 0; err_sysfs_create: - if (bldev != NULL) - backlight_device_unregister(bldev); + backlight_device_unregister(bldev); err_bl: destroy_workqueue(ddata->workqueue); err_reg: diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c index 983c8cf..31f5178 100644 --- a/drivers/gpu/drm/omapdrm/omap_fb.c +++ b/drivers/gpu/drm/omapdrm/omap_fb.c @@ -115,8 +115,8 @@ static void omap_framebuffer_destroy(struct drm_framebuffer *fb) for (i = 0; i < n; i++) { struct plane *plane = &omap_fb->planes[i]; - if (plane->bo) - drm_gem_object_unreference_unlocked(plane->bo); + + drm_gem_object_unreference_unlocked(plane->bo); } kfree(omap_fb);