summaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authordinghao.liu@zju.edu.cn <dinghao.liu@zju.edu.cn>2020-08-21 11:15:13 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-29 12:07:18 +0300
commit2e35f75c9a14aa04c927a1133c413cf8173bdb4a (patch)
tree08e75467fe84c778a98ba833717b5d77277cbf87 /drivers/crypto
parent707041cc6852dfec620ec3cad482ea08d6c9761e (diff)
downloadlinux-2e35f75c9a14aa04c927a1133c413cf8173bdb4a.tar.xz
crypto: ccree - fix runtime PM imbalance on error
[ Upstream commit b7b57a5643c2ae45afe6aa5e73363b553cacd14b ] pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. However, users of cc_pm_get(), a direct wrapper of pm_runtime_get_sync(), assume that PM usage counter will not change on error. Thus a pairing decrement is needed on the error handling path to keep the counter balanced. Fixes: 8c7849a30255c ("crypto: ccree - simplify Runtime PM handling") Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/ccree/cc_pm.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/crypto/ccree/cc_pm.c b/drivers/crypto/ccree/cc_pm.c
index d39e1664fc7e..3c65bf070c90 100644
--- a/drivers/crypto/ccree/cc_pm.c
+++ b/drivers/crypto/ccree/cc_pm.c
@@ -65,8 +65,12 @@ const struct dev_pm_ops ccree_pm = {
int cc_pm_get(struct device *dev)
{
int rc = pm_runtime_get_sync(dev);
+ if (rc < 0) {
+ pm_runtime_put_noidle(dev);
+ return rc;
+ }
- return (rc == 1 ? 0 : rc);
+ return 0;
}
void cc_pm_put_suspend(struct device *dev)