From patchwork Fri Jul 22 08:45:30 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: 9243183 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 ADCD760757 for ; Fri, 22 Jul 2016 08:45:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A71B262FF for ; Fri, 22 Jul 2016 08:45:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A5DF26246; Fri, 22 Jul 2016 08:45:51 +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 3631A26246 for ; Fri, 22 Jul 2016 08:45:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5C30D6EADF; Fri, 22 Jul 2016 08:45:45 +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 E4EBA6EADE for ; Fri, 22 Jul 2016 08:45:41 +0000 (UTC) Received: from [192.168.1.2] ([77.182.75.73]) by smtp.web.de (mrweb004) with ESMTPSA (Nemesis) id 0M3xKs-1b9GRy2qjS-00rYwh; Fri, 22 Jul 2016 10:45:32 +0200 Subject: [PATCH] GPU-DRM-GMA500: Delete unnecessary checks before two function calls To: dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie , Patrik Jakobsson 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> <5447DFD5.5020905@users.sourceforge.net> From: SF Markus Elfring Message-ID: Date: Fri, 22 Jul 2016 10:45:30 +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: <5447DFD5.5020905@users.sourceforge.net> X-Provags-ID: V03:K0:Gmp9GYFS+ZROHxZVk72DCk9xAOroC8YkJkdqM+1wr8P8BKkJlCS sBACmmG9c/2eLdtQsWsP2HGjK5mI58RlgTKX8Es0mObm2PXLYhN/uKxWUi8YFSZvlB08SKp VfaTcC2srQz7eDgPX+U/cwJPi+JSFsKbCJ867kmy8dBZ2ZVUQUbkBCuX/KKSCh7X7mDB0WH ypR6O4gd9L1I8HtU+8okA== X-UI-Out-Filterresults: notjunk:1; V01:K0:3+9aKqLBy8U=:q2qQ0cguKBI1Opv8WDPEUf cJqiLAX8N1mJrvU8b9qjv5zgJ7l4k57OWSaCpJUhxWJJU+k7U4CR4irI0SawpWD0XTBy2eoaW VzQXyZstgb+W8BE6pNLFjBR88LXvAXct/4mDD6XEqfrme7Cifhq/uHQ5FTusUVIwZz/ky87qQ 31BsCWSYzXeiPSoHd4wvFcG6GWpu1Cg910hVWqKwnboqQJMAsqVl35Aa2VYEr9M3A1yrxnSOA +3otl4ArQ9Lt3M5a/TV38zjT+AIS84sMzK2AxzUJuR+SP/a5kTSHxzrtfwFosDHaLw8HQ7kx/ +v4p2Jz2e3CMh3/N47+vy72jWFD76WVYX3x5GGCe8Nhgi3SzhnDrMdJsq9uNEYjt6klx0BKXb wEgAlPQbj8Ph0LYNV9EUiYMlJB0GfHYZBvz0a63RuMSwm7vT8kUHZMKh84iK4hmIDhdKXFDKs DITdhmJePFOUuTVSkbGZma0EeLQ9rl5vpTl21DT78AnHb64c+EOJwA6eE33STxITha9htb4cW 9V6M/xT2/0HIEL7PJ16gI1PqfoPY4We42pQiiUlnKxO427FyW12mzLufV4k6fjOgO/lDhgJce tfluME8znwT2FemaOdZxU/+al7vXa+qwGD85WVRkxnD/LGGoclgJ6VGALfIz4IsRwiKat7zj4 keUoSZTU0nVu7c/z8GWwtDm1W1orxYPQuz7SRxx3VaKOCOVjrj0ybPNgKgSxTlilNbgmY3/hQ nuhq00WnIfw9A9M38e9fm4mp3BIzRpe0VzgqeHpo/dLYovzGUbr2UqJAyj8woN7QoyJO9BqwE 5+Sk3Ck 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 10:30:30 +0200 The functions pci_dev_put() and psb_intel_i2c_destroy() test whether their argument is NULL and then return immediately. 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/gma500/cdv_intel_hdmi.c | 3 +-- drivers/gpu/drm/gma500/cdv_intel_lvds.c | 9 +++------ drivers/gpu/drm/gma500/psb_drv.c | 6 ++---- drivers/gpu/drm/gma500/psb_intel_lvds.c | 9 +++------ 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c index 28f9d90..563f193 100644 --- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c +++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c @@ -246,8 +246,7 @@ static void cdv_hdmi_destroy(struct drm_connector *connector) { struct gma_encoder *gma_encoder = gma_attached_encoder(connector); - if (gma_encoder->i2c_bus) - psb_intel_i2c_destroy(gma_encoder->i2c_bus); + psb_intel_i2c_destroy(gma_encoder->i2c_bus); drm_connector_unregister(connector); drm_connector_cleanup(connector); kfree(connector); diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c index 813ef23..38dc890 100644 --- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c +++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c @@ -444,8 +444,7 @@ static void cdv_intel_lvds_destroy(struct drm_connector *connector) { struct gma_encoder *gma_encoder = gma_attached_encoder(connector); - if (gma_encoder->i2c_bus) - psb_intel_i2c_destroy(gma_encoder->i2c_bus); + psb_intel_i2c_destroy(gma_encoder->i2c_bus); drm_connector_unregister(connector); drm_connector_cleanup(connector); kfree(connector); @@ -780,12 +779,10 @@ out: failed_find: mutex_unlock(&dev->mode_config.mutex); printk(KERN_ERR "Failed find\n"); - if (gma_encoder->ddc_bus) - psb_intel_i2c_destroy(gma_encoder->ddc_bus); + psb_intel_i2c_destroy(gma_encoder->ddc_bus); failed_ddc: printk(KERN_ERR "Failed DDC\n"); - if (gma_encoder->i2c_bus) - psb_intel_i2c_destroy(gma_encoder->i2c_bus); + psb_intel_i2c_destroy(gma_encoder->i2c_bus); failed_blc_i2c: printk(KERN_ERR "Failed BLC\n"); drm_encoder_cleanup(encoder); diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c index 82b8ce4..50eb944f 100644 --- a/drivers/gpu/drm/gma500/psb_drv.c +++ b/drivers/gpu/drm/gma500/psb_drv.c @@ -210,10 +210,8 @@ static int psb_driver_unload(struct drm_device *dev) iounmap(dev_priv->aux_reg); dev_priv->aux_reg = NULL; } - if (dev_priv->aux_pdev) - pci_dev_put(dev_priv->aux_pdev); - if (dev_priv->lpc_pdev) - pci_dev_put(dev_priv->lpc_pdev); + pci_dev_put(dev_priv->aux_pdev); + pci_dev_put(dev_priv->lpc_pdev); /* Destroy VBT data */ psb_intel_destroy_bios(dev); diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c index b1b9331..e55733c 100644 --- a/drivers/gpu/drm/gma500/psb_intel_lvds.c +++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c @@ -561,8 +561,7 @@ void psb_intel_lvds_destroy(struct drm_connector *connector) struct gma_encoder *gma_encoder = gma_attached_encoder(connector); struct psb_intel_lvds_priv *lvds_priv = gma_encoder->dev_priv; - if (lvds_priv->ddc_bus) - psb_intel_i2c_destroy(lvds_priv->ddc_bus); + psb_intel_i2c_destroy(lvds_priv->ddc_bus); drm_connector_unregister(connector); drm_connector_cleanup(connector); kfree(connector); @@ -835,11 +834,9 @@ out: failed_find: mutex_unlock(&dev->mode_config.mutex); - if (lvds_priv->ddc_bus) - psb_intel_i2c_destroy(lvds_priv->ddc_bus); + psb_intel_i2c_destroy(lvds_priv->ddc_bus); failed_ddc: - if (lvds_priv->i2c_bus) - psb_intel_i2c_destroy(lvds_priv->i2c_bus); + psb_intel_i2c_destroy(lvds_priv->i2c_bus); failed_blc_i2c: drm_encoder_cleanup(encoder); drm_connector_cleanup(connector);