From patchwork Thu Nov 2 13:00:10 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: 10038715 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 DB7EA602D8 for ; Thu, 2 Nov 2017 13:00:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE6FC28F78 for ; Thu, 2 Nov 2017 13:00:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C344728F7B; Thu, 2 Nov 2017 13:00:39 +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 5DB9728F78 for ; Thu, 2 Nov 2017 13:00:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752377AbdKBNAZ (ORCPT ); Thu, 2 Nov 2017 09:00:25 -0400 Received: from mout.web.de ([212.227.15.4]:64772 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750858AbdKBNAX (ORCPT ); Thu, 2 Nov 2017 09:00:23 -0400 Received: from [192.168.1.3] ([78.49.200.43]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Mbydi-1dtFut10Hm-00JKJW; Thu, 02 Nov 2017 14:00:13 +0100 Subject: [PATCH v2] PCI: rcar: Use common error handling code in rcar_pcie_enable_msi() 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 References: <20171101081831.ssnuqp5b75lbfu5p@verge.net.au> <7047eb7a-cf93-6a56-08db-a5e8bedbfc57@users.sourceforge.net> <20171102081239.bzaunax3uotejqja@verge.net.au> From: SF Markus Elfring Message-ID: Date: Thu, 2 Nov 2017 14:00:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171102081239.bzaunax3uotejqja@verge.net.au> Content-Language: en-GB X-Provags-ID: V03:K0:h39BGHa7VkCiCS1vBR6fWGNIDU7tvh7lkB35F/PRYk4FxIc3Za0 EyHogixRVQSzBvewVy0eorChjSvHgneKI9PR/N+/w828E79XTxL5scJvq0lKY/82ETk1ePt vmf9jDH6s6CJQd8ICOd1iOw0G3l2GYvE2Z2YrphbVUm1+HN+wMsB9C6Htv8bqrjNUy790F5 r55sIHRWQSkDiL2lE0t0w== X-UI-Out-Filterresults: notjunk:1; V01:K0:+mxUYqwKmcQ=:3CzeSieuCSx47hr9Bvdybx 64+Jvhw8uCyNEJ2yM0Iv6n70ivEP8kS4xZXVCQ5FRNus+SqJNt3Y4f9lVVhT+Dy6prnYHtAAO 3mRMK2skAOJp+qiKns1oc+u966UQW8h0GX+q1xQmnrGYnZEevLo33AUK0FltoNASwHK02AYUT JmzNHSHzfHLodSf5XVmMbf6NUOjzq+PlwFTFcuSpVNmBYwTm6nwNRKRWzMuovAgcT1YNMcbzT h/bJEX98F0fqHmjKlxWTLwjJKza6IyFdLEdqZspN1VCdj6DcPUMjCjteIFjn3oEbVy3/bOP4u mZQp9Dxhy1M+Q0H1rNkMSwXD61xzzT7yQy+UoAejm6ooREaU0kyh0nZqikSgLlvY/YcRkECaB lRYixRLxKd20hog503E6Y5IiZ4f0M19GLX5b5F9Do25mdN5bP5ClbfGb+0mvPY07jxXOkEHbc Cchhf1hUC7nvafuF8pvMZMwiUsVhkCztHTsu/ewoLLTV7lja6y5nzZzfhRWFiACrZxe/zvJGM i0+3ViS7Dx1cNSPUm8OHFPuVo4XWoWTxNNxPKTmv9Rg7AULp+xpSvcJcIQg2MgmWoviH7QNAZ l1hedlPQBG6MPIW3Xlqtn81P2A8/mEMPSTtlafLgUbOLBhkZt1hfMggCBeh4BBjCWe8c/NL2m gQUL6FdGgkkKwoGKw50R8UxfQPRrhIGetRAZd12nbFQAMiYXaXSuKpiaCSEyYnkbM8TIqoftA HTuK1KgR4tXePt4/+8VDISRxVmEEEK4wOECQZxHSn7f+MeRdSC+VTHOUgyXXde4bWELf8Ie7S i8wDMH09CMmbCx3uYZd7DDvmeqLMu2SlydudRD2XzkVHOomdK8= 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: Thu, 2 Nov 2017 13:35:17 +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. Link: https://lkml.org/lkml/2017/11/2/140 Link: https://lkml.kernel.org/r/<20171102081239.bzaunax3uotejqja@verge.net.au> Signed-off-by: Markus Elfring --- v2: An other jump label was requested by Simon Horman. 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..f3c1ffdf8072 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 err_remove_domain; 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 err_remove_domain; /* 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: +err_remove_domain: + dev_err(dev, "failed to request IRQ: %d\n", err); irq_domain_remove(msi->domain); return err; }