public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	"Dan Carpenter" <dan.carpenter@oracle.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eugeniu Rosca" <erosca@de.adit-jv.com>,
	"Kazuya Mizuguchi" <kazuya.mizuguchi.ks@renesas.com>,
	"Masaru Nagai" <masaru.nagai.vx@renesas.com>,
	"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
	"Sergei Shtylyov" <sergei.shtylyov@cogentembedded.com>,
	"Simon Horman" <horms+renesas@verge.net.au>,
	"Yuval Shaia" <yuval.shaia@oracle.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] ravb: Use common error handling code in ravb_probe()
Date: Sat, 28 Oct 2017 17:19:19 +0000	[thread overview]
Message-ID: <2839c3c2-0116-7549-6ff4-a49eb0a52298@users.sourceforge.net> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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)
-- 
2.14.3


             reply	other threads:[~2017-10-28 17:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-28 17:19 SF Markus Elfring [this message]
2017-10-29 11:00 ` [PATCH] ravb: Use common error handling code in ravb_probe() Geert Uytterhoeven
2017-10-29 11:50   ` SF Markus Elfring
2017-10-30 21:08   ` Sergei Shtylyov
2017-10-30 20:51 ` Sergei Shtylyov
2017-10-30 21:19   ` Sergei Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2839c3c2-0116-7549-6ff4-a49eb0a52298@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=erosca@de.adit-jv.com \
    --cc=horms+renesas@verge.net.au \
    --cc=kazuya.mizuguchi.ks@renesas.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=masaru.nagai.vx@renesas.com \
    --cc=netdev@vger.kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=yuval.shaia@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox