From patchwork Tue Mar 13 16:48:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory CLEMENT X-Patchwork-Id: 10280171 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 B937E602BD for ; Tue, 13 Mar 2018 16:59:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A930928635 for ; Tue, 13 Mar 2018 16:59:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D97A28D09; Tue, 13 Mar 2018 16:59:36 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EB1B428635 for ; Tue, 13 Mar 2018 16:59:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=v+rl5rA9RHW5r4VZNFVD+K4mUariE1J5i2o647aiBVI=; b=LF5ZHCraGTDK272zDwpIVLdHHx rOhc78MRDxG7cYJHL1wt/a7JBBFg6B4YgHp4pj7T6Zj+RH626DSEXS/r673EwMhuvTBgM9ys+eTeS oFFJpGC/d1GNebjjdDBPl6DEzNCr44ZOKiPa9QxcoNRu+gfEDFtoRK5rF0tsU7tJ2gn8K8PwVAEgt Und0DyWoRd6ZXWZc3irQKPGJRzaSz64ywmHj75EKngEqQqbtu4yGfWm9te/jbFfR7CUag5/84nPwA 0vrwRBw5xaWCSAVDASIfsJEHgPAV7WpeVdHO6Vdm0OSOiLRsJ7WSWQAxWBgakdqjuG+KPeyYL/mso Ussr5UGw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1evnGq-0000Ua-Si; Tue, 13 Mar 2018 16:59:28 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1evnGN-0008JH-8S for linux-arm-kernel@bombadil.infradead.org; Tue, 13 Mar 2018 16:58:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MsX2zoVuCzjZ6QfJyt8OnTvvK8zWzAGC2hGyqS+y3C4=; b=C6u4y502LRXPALjprHvLqDHbx Y3cVPVBXV7s+RDWGN/LCaj5A0qnLgE2DqSVqO0uZ4/WXWpgi2u8tcH2ukUN5Qc4E3lmc3Wuuu9iww WMD5IZ0S5IJEK0MljOMw0fBE/Jzv/Ey5+wHCDpf8c34ZvyYBKfO96W6FVdUb+MVzfg9XzXtdxWOj+ HMzmZlAd2LjS2sDFeiD6pFJNW2zHyluPIO4fGs/jON8h9e3VlfawIlKvCnMld5rpPjIhB21ocHIil sIHM9LQxFoc5GaECp8uEEk28fGHbJMEmvzKPvFHgiEimUcTe41I13u+jRaYgrox96dmJrPx402A5F 8ohq6W9mw==; Received: from mail.bootlin.com ([62.4.15.54]) by casper.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1evn6t-0007d5-BU for linux-arm-kernel@lists.infradead.org; Tue, 13 Mar 2018 16:49:12 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id 20C6C20888; Tue, 13 Mar 2018 17:49:00 +0100 (CET) Received: from localhost (242.171.71.37.rev.sfr.net [37.71.171.242]) by mail.bootlin.com (Postfix) with ESMTPSA id 8887D20890; Tue, 13 Mar 2018 17:48:48 +0100 (CET) From: Gregory CLEMENT To: Herbert Xu , davem@davemloft.net, linux-crypto@vger.kernel.org, Antoine Tenart , oferh@marvell.com Subject: [PATCH 2/3] crypto: inside-secure - improve clock initialization Date: Tue, 13 Mar 2018 17:48:41 +0100 Message-Id: <20180313164842.20042-3-gregory.clement@bootlin.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180313164842.20042-1-gregory.clement@bootlin.com> References: <20180313164842.20042-1-gregory.clement@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180313_164911_398814_9D3291D9 X-CRM114-Status: GOOD ( 15.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Jason Cooper , Gregory CLEMENT , Omri Itach , Nadav Haklai , Shadi Ammouri , Igal Liberman , Thomas Petazzoni , =?UTF-8?q?Miqu=C3=A8l=20Raynal?= , Marcin Wojtas , Hanna Hawa , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth MIME-Version: 1.0 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 The clock is optional, but if it is present we should managed it. If there is an error while trying getting it, we should exit and report this error. So instead of returning an error only in the -EPROBE case, turn it in an other way and ignore the clock only if it is not present (-ENOENT case). Signed-off-by: Gregory CLEMENT --- drivers/crypto/inside-secure/safexcel.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c index 09adeaa0da6b..cbcb5d9f17bd 100644 --- a/drivers/crypto/inside-secure/safexcel.c +++ b/drivers/crypto/inside-secure/safexcel.c @@ -882,16 +882,17 @@ static int safexcel_probe(struct platform_device *pdev) } priv->clk = devm_clk_get(&pdev->dev, NULL); - if (!IS_ERR(priv->clk)) { + ret = PTR_ERR_OR_ZERO(priv->clk); + /* The clock isn't mandatory */ + if (ret != -ENOENT) { + if (ret) + return ret; + ret = clk_prepare_enable(priv->clk); if (ret) { dev_err(dev, "unable to enable clk (%d)\n", ret); return ret; } - } else { - /* The clock isn't mandatory */ - if (PTR_ERR(priv->clk) == -EPROBE_DEFER) - return -EPROBE_DEFER; } ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));