Skip to content

Commit 2264965

Browse files
Shixin Liugregkh
authored andcommitted
crypto: sun8i-ss - Fix PM reference leak when pm_runtime_get_sync() fails
[ Upstream commit 06cd742 ] pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced. Signed-off-by: Shixin Liu <liushixin2@huawei.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a16162a commit 2264965

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ int sun8i_ss_cipher_init(struct crypto_tfm *tfm)
351351
op->enginectx.op.prepare_request = NULL;
352352
op->enginectx.op.unprepare_request = NULL;
353353

354-
err = pm_runtime_get_sync(op->ss->dev);
354+
err = pm_runtime_resume_and_get(op->ss->dev);
355355
if (err < 0) {
356356
dev_err(op->ss->dev, "pm error %d\n", err);
357357
goto error_pm;

‎drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ static int sun8i_ss_probe(struct platform_device *pdev)
753753
if (err)
754754
goto error_alg;
755755

756-
err = pm_runtime_get_sync(ss->dev);
756+
err = pm_runtime_resume_and_get(ss->dev);
757757
if (err < 0)
758758
goto error_alg;
759759

0 commit comments

Comments
 (0)