From patchwork Thu Dec 22 16:15:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyrille Pitchen X-Patchwork-Id: 9485279 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1E40A600BA for ; Thu, 22 Dec 2016 16:19:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F32627F89 for ; Thu, 22 Dec 2016 16:19:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 028302808C; Thu, 22 Dec 2016 16:19:00 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AD3BA27F89 for ; Thu, 22 Dec 2016 16:19:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cK63R-0006FE-Pt; Thu, 22 Dec 2016 16:17:17 +0000 Received: from smtpout.microchip.com ([198.175.253.82] helo=email.microchip.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cK62M-0005OV-F9 for linux-arm-kernel@lists.infradead.org; Thu, 22 Dec 2016 16:16:12 +0000 Received: from tenerife.corp.atmel.com (10.10.76.4) by chn-sv-exch07.mchp-main.com (10.10.76.108) with Microsoft SMTP Server id 14.3.181.6; Thu, 22 Dec 2016 09:16:04 -0700 From: Cyrille Pitchen To: , , Subject: [PATCH 10/12] crypto: atmel-aes: fix atmel_aes_handle_queue() Date: Thu, 22 Dec 2016 17:15:15 +0100 Message-ID: <82a83bf030641719067b649d67817dd99e445059.1482422983.git.cyrille.pitchen@atmel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAC+NgFupmVWLjYuHi8mHRdf0THWHw//X8N7wWhxdOYbR48L6TxWLa9HfMFvc+bWO06JiyismBNYAhijUzLym/IoE1o31CI3vBFc6K9VsWMjcw/mXvYuTiEBJYzyjxbfsbxi5GTg42AUOJtw+OsoLYIgKBEgtbXjGCFDELTGeUeLD6HTtIQljATeLb65VgRSwCqhJ3H8wAa+YViJeY1D6RCcSWEJCTuHmukxnE5hSwlXh89x5YvZCAjcT/lXdZIeoFJU7OfMICYjMLSEgcfPGCGaJGDWjxCmaIOYESV89vYYOwnSSer7sJZdtJHJ5+kR3CdpDoWvCbGabm6eOLULa2xPZX+1ghbB2JbQf7WSBsW4k9M2DudJd48Gg5lO0rMethA1RNlETbks1sExglZiE5dRaSUxcwMq1ilHb28NMNDtN1jXD2MDDXy03OKNDNTczM00vOz93ECImonB2Mkyf5H2KU5GBSEuXdOul8uBBfUn5KZUZicUZ8UWlOavEhRgkOHiURXv5lQDne4oLE3OLMdJiUDAeHkgTv46VAKcGi1PTUirTMnJLUIoj0KUZJKXHejyBJAZC+jNI8uNwlRlEpYd4okBxPQWpRbmYJRPwWozDHQyYhlrz8vFQpoBMZgECD8RWjOAejkjCvNMgNPJl5JXAnvAK6jgnounW7T4NcV5KIkJJqYJQvYxVZ9vHeoRm8f8Qnbbk28V5isd2MlpZcFSv5ydcn1rAf2PLr79F3acI59x3PXk/L3/T06M7cm9nl06V/f758w3CGy502fbVj6QIKjZuf/zx35OO7lCMVn2yEik1SlP5J1UQ7aiaa1nbeeF/d5XNBXPLB8bU9pXkXPvrqmHxUO5286I7qoUVKLMUZiYZazEXFiQAKG8kOHgMAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161222_081611_092864_5D71A737 X-CRM114-Status: UNSURE ( 9.93 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cyrille Pitchen , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes the value returned by atmel_aes_handle_queue(), which could have been wrong previously when the crypto request was started synchronously but became asynchronous during the ctx->start() call. Signed-off-by: Cyrille Pitchen --- drivers/crypto/atmel-aes.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c index 0e3d0d655b96..9fd2f63b8bc0 100644 --- a/drivers/crypto/atmel-aes.c +++ b/drivers/crypto/atmel-aes.c @@ -879,6 +879,7 @@ static int atmel_aes_handle_queue(struct atmel_aes_dev *dd, struct crypto_async_request *areq, *backlog; struct atmel_aes_base_ctx *ctx; unsigned long flags; + bool start_async; int err, ret = 0; spin_lock_irqsave(&dd->lock, flags); @@ -904,10 +905,12 @@ static int atmel_aes_handle_queue(struct atmel_aes_dev *dd, dd->areq = areq; dd->ctx = ctx; - dd->is_async = (areq != new_areq); + start_async = (areq != new_areq); + dd->is_async = start_async; + /* WARNING: ctx->start() MAY change dd->is_async. */ err = ctx->start(dd); - return (dd->is_async) ? ret : err; + return (start_async) ? ret : err; }