mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-crypto@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Gary Hook <gary.hook@amd.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Tom Lendacky <thomas.lendacky@amd.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] crypto-ccp: Use common error handling code in sp_get_irqs()
Date: Sun, 22 Oct 2017 14:16:53 +0200	[thread overview]
Message-ID: <0abcf065-56e9-dd3c-e210-0b0c21828a84@users.sourceforge.net> (raw)

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

                 reply	other threads:[~2017-10-22 12:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=0abcf065-56e9-dd3c-e210-0b0c21828a84@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=davem@davemloft.net \
    --cc=gary.hook@amd.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas.lendacky@amd.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

Powered by JetHome