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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <0abcf065-56e9-dd3c-e210-0b0c21828a84@users.sourceforge.net>
Date:   Sun, 22 Oct 2017 14:16:53 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-crypto@...r.kernel.org,
        "David S. Miller" <davem@...emloft.net>,
        Gary Hook <gary.hook@....com>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        Tom Lendacky <thomas.lendacky@....com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH] crypto-ccp: Use common error handling code in sp_get_irqs()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sun, 22 Oct 2017 14:10:33 +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/crypto/ccp/sp-platform.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/crypto/ccp/sp-platform.c b/drivers/crypto/ccp/sp-platform.c
index 71734f254fd1..7d7670c7484a 100644
--- a/drivers/crypto/ccp/sp-platform.c
+++ b/drivers/crypto/ccp/sp-platform.c
@@ -78,25 +78,25 @@ static int sp_get_irqs(struct sp_device *sp)
 	sp_platform->irq_count = count;
 
 	ret = platform_get_irq(pdev, 0);
-	if (ret < 0) {
-		dev_notice(dev, "unable to get IRQ (%d)\n", ret);
-		return ret;
-	}
+	if (ret < 0)
+		goto report_failure;
 
 	sp->psp_irq = ret;
 	if (count == 1) {
 		sp->ccp_irq = ret;
 	} else {
 		ret = platform_get_irq(pdev, 1);
-		if (ret < 0) {
-			dev_notice(dev, "unable to get IRQ (%d)\n", ret);
-			return ret;
-		}
+		if (ret < 0)
+			goto report_failure;
 
 		sp->ccp_irq = ret;
 	}
 
 	return 0;
+
+report_failure:
+	dev_notice(dev, "unable to get IRQ (%d)\n", ret);
+	return ret;
 }
 
 static int sp_platform_probe(struct platform_device *pdev)
-- 
2.14.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ