From patchwork Tue Nov 17 15:46:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 7638501 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8FBD1BF90C for ; Tue, 17 Nov 2015 15:47:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A9DC72051C for ; Tue, 17 Nov 2015 15:47:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C56032051A for ; Tue, 17 Nov 2015 15:47:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753068AbbKQPq7 (ORCPT ); Tue, 17 Nov 2015 10:46:59 -0500 Received: from mout.web.de ([212.227.15.4]:51237 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752143AbbKQPq6 (ORCPT ); Tue, 17 Nov 2015 10:46:58 -0500 Received: from [192.168.1.3] ([77.182.159.196]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0MMEyj-1a1kk12SRp-0083uF; Tue, 17 Nov 2015 16:46:48 +0100 Subject: [PATCH v2 3/3] crypto-ixp4xx: Less function calls in init_ixp_crypto() after error detection To: linux-crypto@vger.kernel.org, Herbert Xu , "David S. Miller" References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <5648D2C1.8050603@users.sourceforge.net> <564B489F.10308@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <564B4BE6.6010209@users.sourceforge.net> Date: Tue, 17 Nov 2015 16:46:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <564B489F.10308@users.sourceforge.net> X-Provags-ID: V03:K0:2hg3DLFgXT1FFrtup3Cu4O0QQ4M4fgqd0SwpdObqlH2/jF8K+k/ qKBmKy6z67baxUE+2M4pbc788oEpptpP3VZJk3W2b8PM+Af6PSleN4s0/8W2TlQNDDTsGfo 0Ia3SxryUSgbJgc9nfa6Fv286QBbAsn6rEdRAPc24y4Uhjtzsgu8YeLavrY/sX9SR7CxS+o FoRSesssetydsFgF1TanA== X-UI-Out-Filterresults: notjunk:1; V01:K0:jNgjlZHT4Tg=:ol6ZaTxG3FRJjL4uynLcgR cquWVI4zoAzA2aRVp8GUAGW9UdvRU6R5Peg6TMywcl0fGcl9bBTvp6TnLj0pH+N4JC6HH+Ddj tpCsYHtDY/BXPpnQ0jjUlDk3QCyz8IiQZEAOp9BXBZ/PHVDqiquknTujfUXy5be3Q8Ys9Dhyk 8wrekZl7bUZv7jnFU43O1L9vxsBFsz/Ex54V+e0T7dm/xjECrjODG6K9n4lxRKkzCt6A6AYV4 tR02nfsDhzejON4K+vFETt9rp+S7BHN2nJHE7G+3sI+1y5b2Ck5SgwHmlpT39FX4H7VHHx9EN qXF1O4oSduXGiqXeblq2ifEKMxl5A/GKJcDmozcYQ2+LhcInQLViRGeFNdCvo6ohpz35RxsIw Pjdd9cTI1NkISI4XGqCXYnb8GoakJRKnAHLwwKZvMClXMaYNicV9ddOHNXkgmmgvbT/6V6Xmf KwVRXdaOiEjMcx6SaYkfTL6CKtfWgvpiyHgJszlLDd9MCfOR0FrxfbYXTH/Rq5RRAE94btsaJ 29Fi701ORqsU6w5VceYAwL9scJHgCR3JI8aiY6wf74NF2eVLqlnJiGg8DUf7AyxguH6Q/D8f/ G60bMIDcT9p+Z1gkF1J98hbKCQ/lHW+XG1jQzJlVBTsbyEiRtqjj64lCWcSym+mGzPGx6bWem GYxhqyYKxwhy8hUe7G058ZQmcnAXkkaZRJcPmMdqlBbD9p60lu2tjPngPmTy4tSLdj/dai8SN ts8PtNZzTaoXl/81TJPuTS8iHj3pqtCA4cLz/JpHdgZBvfgmKxdt4fdiqKIKwuOU3Dkne8/Vd rmLmn0V Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Tue, 17 Nov 2015 16:15:21 +0100 The dma_pool_destroy() function was called in up to two cases by the init_ixp_crypto() function during error handling even if a call of the dma_pool_create() function failed. This implementation detail could be improved by the adjustment of jump targets according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/crypto/ixp4xx_crypto.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index 79b6958..0a5969c 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c @@ -483,23 +483,23 @@ static int init_ixp_crypto(struct device *dev) sizeof(struct buffer_desc), 32, 0); if (!buffer_pool) { ret = -ENOMEM; - goto err; + goto release_npe; } ctx_pool = dma_pool_create("context", dev, NPE_CTX_LEN, 16, 0); if (!ctx_pool) { ret = -ENOMEM; - goto err; + goto destroy_buffer_pool; } ret = qmgr_request_queue(SEND_QID, NPE_QLEN_TOTAL, 0, 0, "ixp_crypto:out", NULL); if (ret) - goto err; + goto destroy_ctx_pool; ret = qmgr_request_queue(RECV_QID, NPE_QLEN, 0, 0, "ixp_crypto:in", NULL); if (ret) { qmgr_release_queue(SEND_QID); - goto err; + goto destroy_ctx_pool; } qmgr_set_irq(RECV_QID, QUEUE_IRQ_SRC_NOT_EMPTY, irqhandler, NULL); tasklet_init(&crypto_done_tasklet, crypto_done_action, 0); @@ -510,9 +510,11 @@ static int init_ixp_crypto(struct device *dev) npe_error: printk(KERN_ERR "%s not responding\n", npe_name(npe_c)); ret = -EIO; -err: +destroy_ctx_pool: dma_pool_destroy(ctx_pool); +destroy_buffer_pool: dma_pool_destroy(buffer_pool); +release_npe: npe_release(npe_c); return ret; }