From patchwork Mon Sep 17 15:09:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Manszewski X-Patchwork-Id: 10602899 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8C85A112B for ; Mon, 17 Sep 2018 15:10:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EFF42998B for ; Mon, 17 Sep 2018 15:10:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7348B2A087; Mon, 17 Sep 2018 15:10:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 141DB2A089 for ; Mon, 17 Sep 2018 15:10:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729312AbeIQUh5 (ORCPT ); Mon, 17 Sep 2018 16:37:57 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:59182 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729233AbeIQUh4 (ORCPT ); Mon, 17 Sep 2018 16:37:56 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180917151010euoutp02cc7c6612839a855f6e822e3bebc5d639~VOIl2IFUS1481614816euoutp02I for ; Mon, 17 Sep 2018 15:10:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180917151010euoutp02cc7c6612839a855f6e822e3bebc5d639~VOIl2IFUS1481614816euoutp02I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1537197010; bh=T9jpYh7paRgEMj1xcfos8mLUbeOnMA+vBAv85Pt86X8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o3Tx5V8AM4mhStvjK2+MTQvuuB6BAVvdj0fpsqpZJrYekz0SZtajbkwZxE8VtJHl6 eTzOW1djPLUl6baZYYbBsb2B5bTJ1a1m1Wc+Z3C2vVOweKh010V5FE7RydDv7ZRHT+ 8fHyJtsWhn6JGPkV6kgBVsCsK0FNJWL77k+s68KU= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180917151010eucas1p137a318378eaeabf8518fcb1f8e8a40c3~VOIlRcHs-0556505565eucas1p1v; Mon, 17 Sep 2018 15:10:10 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 6A.34.04294.1D3CF9B5; Mon, 17 Sep 2018 16:10:09 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20180917151009eucas1p145fdde4a56241418a49a1da14c5bdb02~VOIkhD_S60202502025eucas1p1F; Mon, 17 Sep 2018 15:10:09 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20180917151009eusmtrp229eece97d0623a272c92ec0f2378921b~VOIkPLJhD2674126741eusmtrp2v; Mon, 17 Sep 2018 15:10:09 +0000 (GMT) X-AuditID: cbfec7f4-835ff700000010c6-c2-5b9fc3d1354c Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 44.46.04128.1D3CF9B5; Mon, 17 Sep 2018 16:10:09 +0100 (BST) Received: from AMDC2034.DIGITAL.local (unknown [106.120.51.41]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20180917151008eusmtip26c758608bc47011c811759e45550d48f~VOIj0tvfW2392923929eusmtip2b; Mon, 17 Sep 2018 15:10:08 +0000 (GMT) From: Christoph Manszewski To: linux-crypto@vger.kernel.org Cc: Christoph Manszewski , Krzysztof Kozlowski , Vladimir Zapolskiy , Kamil Konieczny , Herbert Xu , "David S. Miller" , linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Bartlomiej Zolnierkiewicz Subject: [PATCH v2 3/4] crypto: s5p-sss: Minor code cleanup Date: Mon, 17 Sep 2018 17:09:29 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537196970-5987-1-git-send-email-c.manszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnleLIzCtJLcpLzFFi42LZduzned2Lh+dHGzy8YGmxccZ6Vovju5cy Wsw538Ji0f1KxqJv339Gi/PnN7Bb3L/3k8ni8q45bBYzzu9jsvj/q5nZgctjy8qbTB7bDqh6 bFrVyebxb+EUFo+D7/YwefRtWcXo8XmTXAB7FJdNSmpOZllqkb5dAlfGw5kzmAuaZSqmHLrD 2MA4V6yLkZNDQsBEYtqTz+xdjFwcQgIrGCU+Nv9khHC+MEps3rqaFcL5zCjx9+weoDIOsJZJ t2Mg4ssZJS5vXMgM19F4ZQEjyFw2AVOJ23c/sYE0iAgoSMz7qgMSZhZoYZb4tZoTxBYWsJZY 2zsbrJxFQFWi89ZzNoiT5CRunutkBrE5BTwk3v+ZxQ4Rn8wucbVRAsTmFSiTONYygxki7iKx 7tUUqF5hiVfHt0DVy0j83zmfCeQ2CYFmRolbX66xQjgTGCUOru5igaiylth04xUTyKHMApoS 63fpQzzpKDHzdCWEySdx460gxPl8EpO2TWeGC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WPi4JRq YLS8+KHuh3Hc6v/G0ltjfun/UbW9HGi/Jnmrw8fdIolF3see3d6iN2t30Tv7X+c4dY80tFfa cju92RPfND1/u+o5O///TckRC2+un5G8X7HGk/n/Jc8X99ZINAbr54tImEg8XGH2cPbaRg3B GE3zbBGFPfdMVi5k+7whPH3K1RP+tYpWr7LClimxFGckGmoxFxUnAgDkmwJBhgIAAA== Message-Id: <20180917151009eucas1p145fdde4a56241418a49a1da14c5bdb02~VOIkhD_S60202502025eucas1p1F@eucas1p1.samsung.com> X-CMS-MailID: 20180917151009eucas1p145fdde4a56241418a49a1da14c5bdb02 X-Msg-Generator: CA X-RootMTR: 20180917151009eucas1p145fdde4a56241418a49a1da14c5bdb02 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180917151009eucas1p145fdde4a56241418a49a1da14c5bdb02 References: <1537196970-5987-1-git-send-email-c.manszewski@samsung.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Modifications in s5p-sss.c: - remove unnecessary 'goto' statements (making code shorter), - change uint_8 and uint_32 to u8 and u32 types (for consistency in the driver and making code shorter), Signed-off-by: Christoph Manszewski Reviewed-by: Krzysztof Kozlowski Acked-by: Kamil Konieczny --- drivers/crypto/s5p-sss.c | 54 +++++++++++++++--------------------------------- 1 file changed, 17 insertions(+), 37 deletions(-) diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c index b7216935236f..ba8f2e2ea88f 100644 --- a/drivers/crypto/s5p-sss.c +++ b/drivers/crypto/s5p-sss.c @@ -249,8 +249,8 @@ struct s5p_aes_reqctx { struct s5p_aes_ctx { struct s5p_aes_dev *dev; - uint8_t aes_key[AES_MAX_KEY_SIZE]; - uint8_t nonce[CTR_RFC3686_NONCE_SIZE]; + u8 aes_key[AES_MAX_KEY_SIZE]; + u8 nonce[CTR_RFC3686_NONCE_SIZE]; int keylen; }; @@ -518,46 +518,28 @@ static int s5p_make_sg_cpy(struct s5p_aes_dev *dev, struct scatterlist *src, static int s5p_set_outdata(struct s5p_aes_dev *dev, struct scatterlist *sg) { - int err; - - if (!sg->length) { - err = -EINVAL; - goto exit; - } + if (!sg->length) + return -EINVAL; - err = dma_map_sg(dev->dev, sg, 1, DMA_FROM_DEVICE); - if (!err) { - err = -ENOMEM; - goto exit; - } + if (!dma_map_sg(dev->dev, sg, 1, DMA_FROM_DEVICE)) + return -ENOMEM; dev->sg_dst = sg; - err = 0; -exit: - return err; + return 0; } static int s5p_set_indata(struct s5p_aes_dev *dev, struct scatterlist *sg) { - int err; - - if (!sg->length) { - err = -EINVAL; - goto exit; - } + if (!sg->length) + return -EINVAL; - err = dma_map_sg(dev->dev, sg, 1, DMA_TO_DEVICE); - if (!err) { - err = -ENOMEM; - goto exit; - } + if (!dma_map_sg(dev->dev, sg, 1, DMA_TO_DEVICE)) + return -ENOMEM; dev->sg_src = sg; - err = 0; -exit: - return err; + return 0; } /* @@ -662,8 +644,7 @@ static irqreturn_t s5p_aes_interrupt(int irq, void *dev_id) bool tx_end = false; bool hx_end = false; unsigned long flags; - uint32_t status; - u32 st_bits; + u32 status, st_bits; int err; spin_lock_irqsave(&dev->lock, flags); @@ -1832,7 +1813,7 @@ static struct ahash_alg algs_sha1_md5_sha256[] = { }; static void s5p_set_aes(struct s5p_aes_dev *dev, - const uint8_t *key, const uint8_t *iv, + const u8 *key, const u8 *iv, unsigned int keylen) { void __iomem *keystart; @@ -1918,7 +1899,7 @@ static int s5p_set_outdata_start(struct s5p_aes_dev *dev, static void s5p_aes_crypt_start(struct s5p_aes_dev *dev, unsigned long mode) { struct ablkcipher_request *req = dev->req; - uint32_t aes_control; + u32 aes_control; unsigned long flags; int err; u8 *iv; @@ -2026,7 +2007,7 @@ static int s5p_aes_handle_req(struct s5p_aes_dev *dev, err = ablkcipher_enqueue_request(&dev->queue, req); if (dev->busy) { spin_unlock_irqrestore(&dev->lock, flags); - goto exit; + return err; } dev->busy = true; @@ -2034,7 +2015,6 @@ static int s5p_aes_handle_req(struct s5p_aes_dev *dev, tasklet_schedule(&dev->tasklet); -exit: return err; } @@ -2056,7 +2036,7 @@ static int s5p_aes_crypt(struct ablkcipher_request *req, unsigned long mode) } static int s5p_aes_setkey(struct crypto_ablkcipher *cipher, - const uint8_t *key, unsigned int keylen) + const u8 *key, unsigned int keylen) { struct crypto_tfm *tfm = crypto_ablkcipher_tfm(cipher); struct s5p_aes_ctx *ctx = crypto_tfm_ctx(tfm);