From patchwork Sun Nov 23 12:00:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 5360511 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9A711C11AC for ; Sun, 23 Nov 2014 12:00:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 857812026D for ; Sun, 23 Nov 2014 12:00:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A34DB20266 for ; Sun, 23 Nov 2014 12:00:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750843AbaKWMAw (ORCPT ); Sun, 23 Nov 2014 07:00:52 -0500 Received: from mout.web.de ([212.227.17.11]:58615 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750822AbaKWMAv (ORCPT ); Sun, 23 Nov 2014 07:00:51 -0500 Received: from [192.168.1.2] ([78.49.20.153]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0M6E6g-1Y8GZu2OAU-00y7hA; Sun, 23 Nov 2014 13:00:40 +0100 Message-ID: <5471CC57.8040603@users.sourceforge.net> Date: Sun, 23 Nov 2014 13:00:23 +0100 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Jean-Christophe Plagniol-Villard , Thomas Winischhofer , Tomi Valkeinen , linux-fbdev@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH 1/1] video: fbdev-SIS: Deletion of unnecessary checks before the function call "pci_dev_put" 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:XdTKo7tN2TAep6XEI36W90/9sCBZvHnlhhXIwLKmzqJ8OLR6NrB IAKd7AswajYUoUWGTpfl/COdZJgKIzwwyp0hfUmY1iK6GhHzo6VaiF4boqnjrYArcivopTL ZJOK06u7Wuyx1rRZ5ef1GSmQrJNd1ao6Vom0VASZEbv5RhiJGMYqEi+6w66xE9Qi7DVNCLg RRbNP6gQyhTZQMQjQRlXw== X-UI-Out-Filterresults: notjunk:1; Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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: Sun, 23 Nov 2014 12:55:25 +0100 The pci_dev_put() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/video/fbdev/sis/sis_main.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/video/fbdev/sis/sis_main.c b/drivers/video/fbdev/sis/sis_main.c index 3f12a2d..6548a3e 100644 --- a/drivers/video/fbdev/sis/sis_main.c +++ b/drivers/video/fbdev/sis/sis_main.c @@ -5989,7 +5989,7 @@ static int sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if(!ivideo->sisvga_enabled) { if(pci_enable_device(pdev)) { - if(ivideo->nbridge) pci_dev_put(ivideo->nbridge); + pci_dev_put(ivideo->nbridge); framebuffer_release(sis_fb_info); return -EIO; } @@ -6202,10 +6202,8 @@ error_0: iounmap(ivideo->video_vbase); error_1: release_mem_region(ivideo->video_base, ivideo->video_size); error_2: release_mem_region(ivideo->mmio_base, ivideo->mmio_size); error_3: vfree(ivideo->bios_abase); - if(ivideo->lpcdev) - pci_dev_put(ivideo->lpcdev); - if(ivideo->nbridge) - pci_dev_put(ivideo->nbridge); + pci_dev_put(ivideo->lpcdev); + pci_dev_put(ivideo->nbridge); if(!ivideo->sisvga_enabled) pci_disable_device(pdev); framebuffer_release(sis_fb_info); @@ -6505,11 +6503,9 @@ static void sisfb_remove(struct pci_dev *pdev) vfree(ivideo->bios_abase); - if(ivideo->lpcdev) - pci_dev_put(ivideo->lpcdev); + pci_dev_put(ivideo->lpcdev); - if(ivideo->nbridge) - pci_dev_put(ivideo->nbridge); + pci_dev_put(ivideo->nbridge); #ifdef CONFIG_MTRR /* Release MTRR region */