From patchwork Tue Nov 17 15:45:35 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: 7638481 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 935A19F392 for ; Tue, 17 Nov 2015 15:46:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B678B204E4 for ; Tue, 17 Nov 2015 15:46:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D1471204D8 for ; Tue, 17 Nov 2015 15:46:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753503AbbKQPpv (ORCPT ); Tue, 17 Nov 2015 10:45:51 -0500 Received: from mout.web.de ([212.227.15.3]:51728 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752912AbbKQPps (ORCPT ); Tue, 17 Nov 2015 10:45:48 -0500 Received: from [192.168.1.3] ([77.182.159.196]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0LaTtv-1aex5C2MIB-00mGQT; Tue, 17 Nov 2015 16:45:37 +0100 Subject: [PATCH v2 2/3] crypto-ixp4xx: Reduce assignment for a variable in init_ixp_crypto() 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: <564B4B9F.9050106@users.sourceforge.net> Date: Tue, 17 Nov 2015 16:45:35 +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:VJPe+BlXm98GeaUCsC8p9lzg6DkG3hKHZgOD8xVFCk8Ag5HlW4e h225QYzvGWJk8vdpZ9euOB93oUSLDnBpsUNylj8F/My9W2kQoElr4pABht3gzdaSgLXb3xC Bgcu2MYyi1EZ1zswWqy4hicBwtFmttQRx0jN1WiIXagLz/cVklpcjJkY/9OTDsIZUP62nI5 F0npAnwOQBXu2J7v8lMsw== X-UI-Out-Filterresults: notjunk:1; V01:K0:eBXBR1TurwU=:g4YwDbDqawTsj9NzBsAa9y Z94WfBP92IOvgaKEH0yqj1SBWAOC4F16RhRpGZQuTjMqFj2zLjW2I9pw08hzLGeD5MTHCgdnB dkn4AdNOqwE53GOo8jXjKdnpXd8uBsKq+WpB3a30ORa1cUZpi3ToV54vSYy8gb8s/EezqO0kN ZwwHUaoaGgLu/oilKAr5nzzCmm+QmIH7e9E4KokB6cWrqf88l3adR7F5R+v5tTv5B6Uh/8NqK j3DHOdywsjbsU/zTvEwY70ik9qWTprraSnhzTT8Nx94XGWdic7NZdvjSMWRKFhMThVaEGxf91 bvYhM/i/5bSGI4coVBa/i1+x65DjZkq6f6aMVEI5nzDybqnJsVkO0GvbFESLBQTDbpLsVm9An qcmxmeSnnvJPCqbUTNRJhEkyXePAZsJjB/dCGcKFguj+fjbGuxGiUtjKbbN+Wh5SGPYaW2cEx nRWgAVpaVnCxVP+4wa0E+DGO9U9mEEdneWojV33xYs9jMe7E/Qrc8EBwr2NTQE7pGk03Q/Ws4 6JNba3C4lGMzgTi0KYEcFDrqlozegS9Hi4Wj8uAG+huzAc4NywtPjX3owOajySBKBECX/S+v2 fgT2uM6O9ll/SjRG7oGPK0Qz7qMcK8yfnyBgg4EGxP4AG7ecfVm53G090nkzdFsomMQgqEx5h MA1TzmY9VbJTfYY0lglaMdL+dUv2wVE6pdLF764ucGfmHJ/Qh4xhLArffPa7R+RBuVpkbRNmE Op7/s1D6zqAn4OfoEEsiRuckal/VZxoIAhQlkfYkLigSqkJ2dDysL2hxv+GzNXLqo44UMU/Ty 5Pjxf9r 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 15:45:32 +0100 The variable "ret" was set more often than necessary by the init_ixp_crypto() function. * Omit its initialisation at the beginning. * Use an error return code in two cases directly. * Improve compliance with the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/crypto/ixp4xx_crypto.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index e52496a..79b6958 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c @@ -433,17 +433,17 @@ static void crypto_done_action(unsigned long arg) static int init_ixp_crypto(struct device *dev) { - int ret = -ENODEV; + int ret; u32 msg[2] = { 0, 0 }; if (! ( ~(*IXP4XX_EXP_CFG2) & (IXP4XX_FEATURE_HASH | IXP4XX_FEATURE_AES | IXP4XX_FEATURE_DES))) { printk(KERN_ERR "ixp_crypto: No HW crypto available\n"); - return ret; + return -ENODEV; } npe_c = npe_request(NPE_ID); if (!npe_c) - return ret; + return -ENODEV; if (!npe_running(npe_c)) { ret = npe_load_firmware(npe_c, npe_name(npe_c), dev); @@ -481,13 +481,14 @@ static int init_ixp_crypto(struct device *dev) BUILD_BUG_ON(SHA1_DIGEST_SIZE > sizeof(struct buffer_desc)); buffer_pool = dma_pool_create("buffer", dev, sizeof(struct buffer_desc), 32, 0); - ret = -ENOMEM; if (!buffer_pool) { + ret = -ENOMEM; goto err; } ctx_pool = dma_pool_create("context", dev, NPE_CTX_LEN, 16, 0); if (!ctx_pool) { + ret = -ENOMEM; goto err; } ret = qmgr_request_queue(SEND_QID, NPE_QLEN_TOTAL, 0, 0,