From patchwork Sat Jul 23 10:58:08 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: 9244585 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 BABD260459 for ; Sat, 23 Jul 2016 10:58:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC03A280D0 for ; Sat, 23 Jul 2016 10:58:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A10C32816B; Sat, 23 Jul 2016 10:58:37 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A391280D0 for ; Sat, 23 Jul 2016 10:58:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751340AbcGWK6W (ORCPT ); Sat, 23 Jul 2016 06:58:22 -0400 Received: from mout.web.de ([212.227.17.12]:55671 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751271AbcGWK6U (ORCPT ); Sat, 23 Jul 2016 06:58:20 -0400 Received: from [192.168.1.2] ([78.53.49.29]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0LfRnJ-1ayDbJ4AuX-00p2Cs; Sat, 23 Jul 2016 12:58:13 +0200 Subject: [PATCH 1/3] IB/mthca: Delete an unnecessary check before the function call "pci_dev_put" To: linux-rdma@vger.kernel.org, Doug Ledford , Hal Rosenstock , Sean Hefty 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> <546CE09B.9090101@users.sourceforge.net> <55b7a06e-6bb4-f1bb-e4dd-7812648ecf34@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <989c5ce4-4e66-04f1-6c4e-f371337852d7@users.sourceforge.net> Date: Sat, 23 Jul 2016 12:58:08 +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: <55b7a06e-6bb4-f1bb-e4dd-7812648ecf34@users.sourceforge.net> X-Provags-ID: V03:K0:bZytDgmtFOgU2j90fr7H/ZLdau3l/hlv9hXvXmcJgnQ8wtUL5CZ LxAiiffT7xeo2g0k9mKw+Zn4h2K/JXCbvsP+qZ+erfkYpc+q1SlICOMT6w+0q1pBT6FBiix MmArtSPD/RshEjREn1m8SXfK3Etxf88AedCYLvDdBZomsfkd3Ttq0ecekFZVIffM1YK07Fk JQ85J3SU/h3cbNf4BZTIA== X-UI-Out-Filterresults: notjunk:1; V01:K0:cBdm+21/Ajs=:EpfJNoyaGsfTeTeCRVYL2b Ix5dFyX6O4jApBBgZokZAZ9eVGWxo8tFVDPMffCoij2hd9DePItIr767ImdspdDfST+jvgK3P dqTdb2m6QJ/H9fsypgXXW6tpCcpXVqrq0+fmDlVzETPxgMU1eb+0uPTDvGZXD5airzX9D8+WT BYlsjgpvu5xRQmYZVcGwkcNhjqUaxwqW2P73cXSzzvBD2F3vhvhx1OqAIYVuuNUTtMZ7ooeeo V2j+qMzszTrRUedp61wsimtV1GjfCKlxR4ZHoWg3o7kgsd6xYV9HNXCuFAhGhNrCcuGYgUczI 6dhzfPQjTe2P1/8HdkMzOz+nXTQqMyZ2EhVvVNQL5dgi5v2AU8GJcjxhHnFSP1FboKJgeHl0k 64IAH8Lyw2gA8Tk+kfagzV1EmbuWcblxpIWqiYQKbHHpPQQCqq2xbUAqg57qMjecCCGX2BpI7 ziahat/c7vgBv1LyQ98bmwZvbqpNwlywskVqK6hZ976yynQHBy/ififvQ5VPpeeiEK5I8tbk2 csRP5Z3PxScwlOgaWAiQCyueeeTeN0GuRzUbQ/rC061PTyLq3y7wC386WXJjpoyq46uH7gioV lwID98G8kCTXd6w4BhR6ix0ZFiUjK3IDkVce2juBvEcRj70FQrLDb1HmXCfNFRctXSMbZLDYo Ss9rYkCoyv1hr+ZN6Eyke4837opBCPTvR5ymjNqglI5nYeWX/qOWx1idVTzBApgA5jLSis3ET BPT0K1D8atfO8S54o2jcKkdNVG7OJVPuwEqkywzQaNgLBebHyNLc8lQMzCL5yHHaEGn7jWxcd 2CLtWFZ Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 23 Jul 2016 10:05:12 +0200 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 Reviewed-by: Leon Romanovsky --- drivers/infiniband/hw/mthca/mthca_reset.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/mthca/mthca_reset.c b/drivers/infiniband/hw/mthca/mthca_reset.c index 74c6a94..c521654 100644 --- a/drivers/infiniband/hw/mthca/mthca_reset.c +++ b/drivers/infiniband/hw/mthca/mthca_reset.c @@ -279,8 +279,7 @@ good: } out: - if (bridge) - pci_dev_put(bridge); + pci_dev_put(bridge); kfree(bridge_header); kfree(hca_header);