lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 28 Oct 2017 19:19:19 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     netdev@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
        Dan Carpenter <dan.carpenter@...cle.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eugeniu Rosca <erosca@...adit-jv.com>,
        Kazuya Mizuguchi <kazuya.mizuguchi.ks@...esas.com>,
        Masaru Nagai <masaru.nagai.vx@...esas.com>,
        Niklas Söderlund 
        <niklas.soderlund+renesas@...natech.se>,
        Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
        Simon Horman <horms+renesas@...ge.net.au>,
        Yuval Shaia <yuval.shaia@...cle.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH] ravb: Use common error handling code in ravb_probe()

From: Markus Elfring <elfring@...rs.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@...rs.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

Powered by blists - more mailing lists