From patchwork Sun Nov 15 18:52:22 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: 7619571 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 74F1E9F1D3 for ; Sun, 15 Nov 2015 18:52:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 90B9A205B9 for ; Sun, 15 Nov 2015 18:52:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 908B42053D for ; Sun, 15 Nov 2015 18:52:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752514AbbKOSwc (ORCPT ); Sun, 15 Nov 2015 13:52:32 -0500 Received: from mout.web.de ([212.227.15.4]:64530 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751629AbbKOSwb (ORCPT ); Sun, 15 Nov 2015 13:52:31 -0500 Received: from [192.168.1.3] ([77.182.168.43]) by smtp.web.de (mrweb004) with ESMTPSA (Nemesis) id 0MbMg8-1ZhSvj2H0G-00IlKU; Sun, 15 Nov 2015 19:52:23 +0100 Subject: [PATCH 3/4] crypto-ixp4xx: Reduce assignment for a variable in init_ixp_crypto() To: "David S. Miller" , Herbert Xu , linux-crypto@vger.kernel.org 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> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <5648D466.10307@users.sourceforge.net> Date: Sun, 15 Nov 2015 19:52:22 +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: <5648D2C1.8050603@users.sourceforge.net> X-Provags-ID: V03:K0:e9wqxtHRI/FE5ta2elfXqgkebGbDjGlvU0WeJCmg5xyLimpd7B9 +T4hjx188OEkWHoVB9Omy0GmCoocgz9mvvP2gqSHZX9zGRW+P85/Xbcy6Mm+lj2h3QvWv62 sBTVT6HJR/Abdgz2HLbMuSnR6xDIR7lNnBJdPAYI1a3uTRjNvjt0rYC1rBKI/QCFA0zQk/F /SWiXawCO5lm6WNiaAXgQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:C+dNks2/50A=:jNLGRiyz25jzrYCgbBLC5v wXNi2gmoyNMdhTPmDFUmb84FP5lzTQ1LDkMY/+0cAAkPoY94l/4KpjWOtIB6twawH+zpRJF1B 7DLfNio7FVoB2YPuRIyf1YxasicifCtQcRoV4XU79/hj5OR4UOO3OCgFwBDrYvQ2dLe/Fq33T 7Lg82l8fK599LCL75W5tmJduDm+M0k1D9ubFUC0i+1Xy917+zLN5HDPGYpCex7aKmTgPkgfsY pZyPw1h8Ry266OxsmPl/IqS9ifmqeCdp7ZYxPbmm46nFq4ShR3ab4Pkgh8OX/RVaChOePX6ID VgTbAoWtV/is1+sGr77OpkC/AQdMtr9S8Bu6jMMBCOg5JkdyGHYFy//gDA9yGP8PCsmz1mdz3 2yGxSiESqb3+PvowYvshkvpEYwMxLUbqr99M1AyD74qoOJwGIDXyhZ1JPZUCV/M49Cnn0SOP/ Cnc5lgc2gpriQ6k/Js6qUjh4+osMF9cmJxXs9bgd+azndCKnaHySd5gb7il8BbUYsqCEOkFgh yvGT4Fw3XzMzU39cwgBVCJeH1IMUSWO20ujf3S998lYYEV6RI4ammMcCObu9DewcRJjY2j0+b yRudIFFpjOo+utOLDbyQ0xlGLwJ+WSfZ7sJgBW1JoTFKDZBBSpAtOLAbCxsWZE3YZ9SH8aBLe tC8T0sm4XFBdKiwql2AtTlh8Q3KcRPbGfp8AHkWbOyk/+yCrBsvOqnQQzBJYHZPmv5U2xZxts Cjd8BYJsUhN2ubGHJiPvEfPtBj9WKoc2i2abYKclhyrxPtPZkjM2iTAZe9DXNEp6GzDcEO/Aa tnLavyo 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: Sun, 15 Nov 2015 19:06:44 +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 efe0eca..97da36a 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,