From patchwork Fri Oct 2 12:12:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 7315111 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 97CBBBEEA4 for ; Fri, 2 Oct 2015 12:13:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 85019208A2 for ; Fri, 2 Oct 2015 12:13:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A269B208A1 for ; Fri, 2 Oct 2015 12:13:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752119AbbJBMNF (ORCPT ); Fri, 2 Oct 2015 08:13:05 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:35134 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752069AbbJBMNE (ORCPT ); Fri, 2 Oct 2015 08:13:04 -0400 Received: by wicge5 with SMTP id ge5so30407960wic.0; Fri, 02 Oct 2015 05:13:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=rpvek0ohuXbZaZ5rOXqfD+noI5AFoxJSYaBUCthffgQ=; b=KIB9lWk3TBYGAUDa4sanJw01hiWC4W7a7USPcDgfOmb6ufQHce2g40MJnvGK114m/v txdJ1NNvh6VqfBx8cR7DCP2rl7mXRMS+6kIgUD2OpAR/icXTdxOXp6KsjnxuDnsUbcsX px5m00tYGO4q+37/nHL0OoAjiTleTOMNV4Jn9UEZbxu5V4fwVP50Q93UspNGWalYoges eDIArJoCgZ7aAGS2v5aJhZhXQA4X8PeARNWiEuqjaj7RUcmCYWxOvi95VSaqXEFd0q3P 1vrMQc16+Ro48bB1uEPCHkKLp98QCskVFrx0iwxW8h0PIrmb7l5box7KXZJTV7ExYlVi 2buw== X-Received: by 10.180.86.100 with SMTP id o4mr3837007wiz.59.1443787983114; Fri, 02 Oct 2015 05:13:03 -0700 (PDT) Received: from Red.local (ANice-651-1-1-116.w83-197.abo.wanadoo.fr. [83.197.195.116]) by smtp.googlemail.com with ESMTPSA id gc8sm8116400wib.2.2015.10.02.05.13.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Oct 2015 05:13:02 -0700 (PDT) From: LABBE Corentin To: herbert@gondor.apana.org.au, davem@davemloft.net Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, LABBE Corentin Subject: [PATCH] crypto: atmel: Check for clk_prepare_enable() return value Date: Fri, 2 Oct 2015 14:12:58 +0200 Message-Id: <1443787978-26624-1-git-send-email-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.4.9 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_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 clk_prepare_enable() can fail so add a check for this and return the error code if it fails. Signed-off-by: LABBE Corentin --- drivers/crypto/atmel-aes.c | 6 +++++- drivers/crypto/atmel-sha.c | 6 +++++- drivers/crypto/atmel-tdes.c | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c index 0f9a9dc..de8f5da 100644 --- a/drivers/crypto/atmel-aes.c +++ b/drivers/crypto/atmel-aes.c @@ -260,7 +260,11 @@ static struct atmel_aes_dev *atmel_aes_find_dev(struct atmel_aes_ctx *ctx) static int atmel_aes_hw_init(struct atmel_aes_dev *dd) { - clk_prepare_enable(dd->iclk); + int err; + + err = clk_prepare_enable(dd->iclk); + if (err) + return err; if (!(dd->flags & AES_FLAGS_INIT)) { atmel_aes_write(dd, AES_CR, AES_CR_SWRST); diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c index 5b35433..5e6cf08 100644 --- a/drivers/crypto/atmel-sha.c +++ b/drivers/crypto/atmel-sha.c @@ -794,7 +794,11 @@ static void atmel_sha_finish_req(struct ahash_request *req, int err) static int atmel_sha_hw_init(struct atmel_sha_dev *dd) { - clk_prepare_enable(dd->iclk); + int err; + + err = clk_prepare_enable(dd->iclk); + if (err) + return err; if (!(SHA_FLAGS_INIT & dd->flags)) { atmel_sha_write(dd, SHA_CR, SHA_CR_SWRST); diff --git a/drivers/crypto/atmel-tdes.c b/drivers/crypto/atmel-tdes.c index ca29997..504e903 100644 --- a/drivers/crypto/atmel-tdes.c +++ b/drivers/crypto/atmel-tdes.c @@ -218,7 +218,11 @@ static struct atmel_tdes_dev *atmel_tdes_find_dev(struct atmel_tdes_ctx *ctx) static int atmel_tdes_hw_init(struct atmel_tdes_dev *dd) { - clk_prepare_enable(dd->iclk); + int err; + + err = clk_prepare_enable(dd->iclk); + if (err) + return err; if (!(dd->flags & TDES_FLAGS_INIT)) { atmel_tdes_write(dd, TDES_CR, TDES_CR_SWRST);