From patchwork Wed May 20 07:54:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dinghao Liu X-Patchwork-Id: 11559691 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B48B90 for ; Wed, 20 May 2020 08:15:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7DFB92072C for ; Wed, 20 May 2020 08:15:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726425AbgETIPT (ORCPT ); Wed, 20 May 2020 04:15:19 -0400 Received: from aliyun-cloud.icoremail.net ([47.90.73.12]:22615 "HELO aliyun-sdnproxy-4.icoremail.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with SMTP id S1726403AbgETIPS (ORCPT ); Wed, 20 May 2020 04:15:18 -0400 X-Greylist: delayed 716 seconds by postgrey-1.27 at vger.kernel.org; Wed, 20 May 2020 04:15:16 EDT Received: from localhost.localdomain (unknown [222.205.77.158]) by mail-app2 (Coremail) with SMTP id by_KCgAH75Fh4sRezsiKAQ--.42332S4; Wed, 20 May 2020 15:55:17 +0800 (CST) From: Dinghao Liu To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: Corentin Labbe , Herbert Xu , "David S. Miller" , Maxime Ripard , Chen-Yu Tsai , Chen Zhou , Colin Ian King , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] crypto: sun8i-ce - fix runtime pm imbalance on error Date: Wed, 20 May 2020 15:54:49 +0800 Message-Id: <20200520075456.21670-1-dinghao.liu@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: by_KCgAH75Fh4sRezsiKAQ--.42332S4 X-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-CM-SenderInfo: qrrzjiaqtzq6lmxovvfxof0/ Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org pm_runtime_get_sync() increments the runtime PM usage counter even it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced. Signed-off-by: Dinghao Liu --- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c index 3e4e4bbda34c..18f0f251204c 100644 --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c @@ -598,8 +598,10 @@ static int sun8i_ce_probe(struct platform_device *pdev) goto error_alg; err = pm_runtime_get_sync(ce->dev); - if (err < 0) + if (err < 0) { + pm_runtime_put_sync(ce->dev); goto error_alg; + } v = readl(ce->base + CE_CTR); v >>= CE_DIE_ID_SHIFT;