Skip to content

Commit 06cd742

Browse files
Shixin Liuherbertx
authored andcommitted
crypto: sun8i-ss - Fix PM reference leak when pm_runtime_get_sync() fails
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>
1 parent ac98fc5 commit 06cd742

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
@@ -354,7 +354,7 @@ int sun8i_ss_cipher_init(struct crypto_tfm *tfm)
354354
op->enginectx.op.prepare_request = NULL;
355355
op->enginectx.op.unprepare_request = NULL;
356356

357-
err = pm_runtime_get_sync(op->ss->dev);
357+
err = pm_runtime_resume_and_get(op->ss->dev);
358358
if (err < 0) {
359359
dev_err(op->ss->dev, "pm error %d\n", err);
360360
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)