From patchwork Sat Oct 28 17:19:19 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: 10031075 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 3F0A96032C for ; Sat, 28 Oct 2017 17:20:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21051287C3 for ; Sat, 28 Oct 2017 17:20:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10472287E7; Sat, 28 Oct 2017 17:20:12 +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 B1061287C3 for ; Sat, 28 Oct 2017 17:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751446AbdJ1RTy (ORCPT ); Sat, 28 Oct 2017 13:19:54 -0400 Received: from mout.web.de ([212.227.17.11]:64150 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751230AbdJ1RTx (ORCPT ); Sat, 28 Oct 2017 13:19:53 -0400 Received: from [192.168.1.2] ([78.53.48.73]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LmcjH-1dZzMU0kqp-00aFhZ; Sat, 28 Oct 2017 19:19:25 +0200 To: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Dan Carpenter , "David S. Miller" , Eugeniu Rosca , Kazuya Mizuguchi , Masaru Nagai , =?UTF-8?Q?Niklas_S=c3=b6derlund?= , Sergei Shtylyov , Simon Horman , Yuval Shaia From: SF Markus Elfring Subject: [PATCH] ravb: Use common error handling code in ravb_probe() Cc: LKML , kernel-janitors@vger.kernel.org Message-ID: <2839c3c2-0116-7549-6ff4-a49eb0a52298@users.sourceforge.net> Date: Sat, 28 Oct 2017 19:19:19 +0200 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:KA59nstY5sw3Hy3fqEiBEkvffe3suXu8dG7+UAFlN/uvB9kQnvE wP6RapVsLzIq1gXtM4dtNfJLhjgTRdfwHrAS3scnTfAHhKDIieJfj/AkDXHEYpUn+EREd0h +SI+byLENvjv0Ni8NuGKOyM4f3Xbs7L9Tk9D1iBDsGUtEXS6PizXBwJ6syRLCwma5hUBGpA Q80wrvQ4hIu1IkuKPiWdQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:aX7wjo8Vp+M=:otjWoE3TT1FTSClHzBSEaY PT1brCIX+oSBtPIUmA7m2wXXxb7wS6Z9oXVIzeBFxLxK5EJFA6IJ2ExsxAO0kTCGbNGvpGBaY mWrJVCHutOTWN0CLeSB1STNi4Jdg0CI+Rnhb/dMLFlbvo7m9vKQyOb4ETsKTQ/nJa/LQhHXnU rlVeVzWNNpVWkj70qhqot+GrRagwE1cLEtJEafOHjxL1YGVfaPQQ6rwUt3efqvJrihH/093Z5 Sy0o4nn2YUTX50fZc1h4UFxbg6/wcu0fL0shQtsutO0nzHYyjGAsSPZdmWVXI885VWHeRTF74 0PsWnxUcz18lV5HwPrKPFOOw4wPmJBm5Q3uuHqVFa5UkA3Dy+ijm0a4VtmZmjlLv6inTfC+QK mdibC5k6aSbZRgfXQeLfj5AnkqX4FFLr+tDmsJadyxwdKy+zrL3kDeI1qruZKp3YagHu+JMkZ pSfcOKH/OTH/GZjUv3c4T1c+gyCs9FYvGAt7DUQPEaEuTaU9cco3Ngm56j3r0NaxtxBTOGvkL 50xgiUYF1KQeD+pYQgml47DJ7wiiinGLUeW92NUuAFlXgjgZJQCY9lye7qGf3Kyo5xDMw/EaO oOLSLyUaRQBOjrsUydZsyg3qR9YtU4e1PulsMjZm77rikw6Bn4kFwLh6dR2RtGjcu7D2bHysR nyYHbLctBsrF+2h+n6ZlaX8d5tNd1dDFkKNAkLza5rhUNg19fuVvGj8I1OaBJXW9xWk7hSn+7 GcOi54p9RdFNi0lCMUggmuKns126Ga93rN44+hC6y3ihb0krJc0kLw/RamfQgyq6hGjEN75DS Ji2tLpgtZv2UhML5WkzLyPz+iVpTH5YVVVHnOyLHO8jkRrF4JE= 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: Sat, 28 Oct 2017 19:10:08 +0200 Add a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/net/ethernet/renesas/ravb_main.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index a8822a756e08..62dbdf7de6cd 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2069,10 +2069,9 @@ static int ravb_probe(struct platform_device *pdev) irq = platform_get_irq_byname(pdev, "ch22"); else irq = platform_get_irq(pdev, 0); - if (irq < 0) { - error = irq; - goto out_release; - } + if (irq < 0) + goto failure_indication; + ndev->irq = irq; SET_NETDEV_DEV(ndev, &pdev->dev); @@ -2101,25 +2100,22 @@ static int ravb_probe(struct platform_device *pdev) if (chip_id == RCAR_GEN3) { irq = platform_get_irq_byname(pdev, "ch24"); - if (irq < 0) { - error = irq; - goto out_release; - } + if (irq < 0) + goto failure_indication; + priv->emac_irq = irq; for (i = 0; i < NUM_RX_QUEUE; i++) { irq = platform_get_irq_byname(pdev, ravb_rx_irqs[i]); - if (irq < 0) { - error = irq; - goto out_release; - } + if (irq < 0) + goto failure_indication; + priv->rx_irqs[i] = irq; } for (i = 0; i < NUM_TX_QUEUE; i++) { irq = platform_get_irq_byname(pdev, ravb_tx_irqs[i]); - if (irq < 0) { - error = irq; - goto out_release; - } + if (irq < 0) + goto failure_indication; + priv->tx_irqs[i] = irq; } } @@ -2226,6 +2222,10 @@ static int ravb_probe(struct platform_device *pdev) pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev); return error; + +failure_indication: + error = irq; + goto out_release; } static int ravb_remove(struct platform_device *pdev)