From patchwork Mon Oct 30 07:35:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10032169 X-Patchwork-Delegate: geert@linux-m68k.org 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 815B76039A for ; Mon, 30 Oct 2017 07:36:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 743322874C for ; Mon, 30 Oct 2017 07:36:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6846C28732; Mon, 30 Oct 2017 07:36:03 +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=unavailable 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 14DC028732 for ; Mon, 30 Oct 2017 07:36:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751437AbdJ3Hfu (ORCPT ); Mon, 30 Oct 2017 03:35:50 -0400 Received: from mout.web.de ([212.227.17.12]:61447 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751221AbdJ3Hfs (ORCPT ); Mon, 30 Oct 2017 03:35:48 -0400 Received: from [192.168.1.2] ([77.181.252.76]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MOilO-1e304S1Pug-0067aw; Mon, 30 Oct 2017 08:35:38 +0100 To: linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Bjorn Helgaas , Laurent Pinchart , Simon Horman Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Subject: [PATCH] PCI: rcar: Use common error handling code in rcar_pcie_enable_msi() Message-ID: Date: Mon, 30 Oct 2017 08:35:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K0:r6T/wzL4+bBUW2l+YXeeFhRCek0j24KISPvwdoI+atbEwGpDXtU HNYoSrTB7WMguUoC2iUQ/m08E/KCEiHf9yT7VG13SkUQfQxf+hB/Lnmw8f9+xkGcqv0Uqpt 7uhwVeSqolu7qAbulck0e4diZxZEZqnBkpmAPNeh/KtLaXAnLlmQfPMifRhdarbLfSE0wK7 iniWldhBGz1cHnzg5RcBw== X-UI-Out-Filterresults: notjunk:1; V01:K0:APv2lftq0BM=:7GwERpgJEtfS3KFCqGtQt3 ChxgOekV68kZMVQ0+Cp3ClJrXMfxc3bZXm0hGMVwJ/6EslUu/LzMW0IYrIarep5GTUVeJfKst 7mWR2mu6OX9p7Hc1eVDeCJmzIHTPrjGYvOiB9XqO134xcJtOASHeSxm8WXuBZnVwJfcwHzMF8 y/GDPHe6MaRI5UqoGTBcuaxsqoOoeL8eW/XVCZ6r5ElJSqzLFtqXUrk1C6b92eq+7YOA6L2KF dgcfH4X09zsBAU+FMI8T92WQqLjv+GBtd22cSVh2VUFBRGtM44KyPAL+QTmIm5KPXY8czVBNG joYq5L7PxVKA3VNB/7i45N3LSxz3JxxR5L5EVNujxdDGqv0MOqppew6QmVe2pBjtAYuMmezj9 5tij7pJKbfMyEkuFUMQ9H/VdpeUHwTVo+9SHeth4CZPBIcV7RvXeTL/pcK6r8bQ5mMOUJU1mH BBjqo2Jrnz4YHOVGwSI0kQ5c8boDPChLahqxbn1tVLo+Deje0hOLvSe1DtqtM/gjOAOJx2Myo ubgVv6oM3BMJA8FjNlC0SE+S77J2PiYDm0wgXDRtX+2kfERB112JTxi6RKuHrodDFZuZ8OVwJ ASDEtF+p+d8nC4SilHLWEXrr4+pFKR7rTbGTKbT0ORF3cnrgYTuQEAJjXkETGIufJ+U0e1fgJ Cc0Cykv6+IJxVZyygec6anhGqklv+TLaGUBUtdW++ULjJfHkcC5lL91HrvF4WfCSmX5+3dzhs ep8+w/kq1Wy66CD5+OQmNjbP0PR2kJEGZ4Y+CdVcgHB5Fom2fXuqMspWVYNxApkZvqC3VeVMm LuQyyNz6kCRk20Wu+Ay7E3ffBjuOKIKW3zDZIuI5VLdnhg3/WM= Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Mon, 30 Oct 2017 08:28:06 +0100 Adjust a jump target so that a specific error message is stored only once at the end of this function implementation. Replace two calls of the function "dev_err" by goto statements. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/pci/host/pcie-rcar.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c index 12796eccb2be..38101f8bebf1 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c @@ -873,18 +873,14 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie) err = devm_request_irq(dev, msi->irq1, rcar_pcie_msi_irq, IRQF_SHARED | IRQF_NO_THREAD, rcar_msi_irq_chip.name, pcie); - if (err < 0) { - dev_err(dev, "failed to request IRQ: %d\n", err); - goto err; - } + if (err < 0) + goto report_request_failure; err = devm_request_irq(dev, msi->irq2, rcar_pcie_msi_irq, IRQF_SHARED | IRQF_NO_THREAD, rcar_msi_irq_chip.name, pcie); - if (err < 0) { - dev_err(dev, "failed to request IRQ: %d\n", err); - goto err; - } + if (err < 0) + goto report_request_failure; /* setup MSI data target */ msi->pages = __get_free_pages(GFP_KERNEL, 0); @@ -898,7 +894,8 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie) return 0; -err: +report_request_failure: + dev_err(dev, "failed to request IRQ: %d\n", err); irq_domain_remove(msi->domain); return err; }