Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Shixin Liu and committed by
Herbert Xu
747bf30f 1cb3ad70

+2 -2
+2 -2
drivers/crypto/stm32/stm32-cryp.c
··· 542 542 int ret; 543 543 u32 cfg, hw_mode; 544 544 545 - pm_runtime_get_sync(cryp->dev); 545 + pm_runtime_resume_and_get(cryp->dev); 546 546 547 547 /* Disable interrupt */ 548 548 stm32_cryp_write(cryp, CRYP_IMSCR, 0); ··· 2043 2043 if (!cryp) 2044 2044 return -ENODEV; 2045 2045 2046 - ret = pm_runtime_get_sync(cryp->dev); 2046 + ret = pm_runtime_resume_and_get(cryp->dev); 2047 2047 if (ret < 0) 2048 2048 return ret; 2049 2049