Skip to content

Commit 747bf30

Browse files
Shixin Liuherbertx
authored andcommitted
crypto: stm32/cryp - Fix PM reference leak on stm32-cryp.c
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 1cb3ad7 commit 747bf30

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/crypto/stm32/stm32-cryp.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ static int stm32_cryp_hw_init(struct stm32_cryp *cryp)
542542
int ret;
543543
u32 cfg, hw_mode;
544544

545-
pm_runtime_get_sync(cryp->dev);
545+
pm_runtime_resume_and_get(cryp->dev);
546546

547547
/* Disable interrupt */
548548
stm32_cryp_write(cryp, CRYP_IMSCR, 0);
@@ -2043,7 +2043,7 @@ static int stm32_cryp_remove(struct platform_device *pdev)
20432043
if (!cryp)
20442044
return -ENODEV;
20452045

2046-
ret = pm_runtime_get_sync(cryp->dev);
2046+
ret = pm_runtime_resume_and_get(cryp->dev);
20472047
if (ret < 0)
20482048
return ret;
20492049

0 commit comments

Comments
 (0)