Skip to content

Commit b35263f

Browse files
herbertxgregkh
authored andcommitted
crypto: stm32 - Revert broken pm_runtime_resume_and_get changes
[ Upstream commit 3d6b661 ] We should not call pm_runtime_resume_and_get where the reference count is expected to be incremented unconditionally. This patch reverts these calls to the original unconditional get_sync call. Reported-by: Heiner Kallweit <hkallweit1@gmail.com> Fixes: 747bf30 ("crypto: stm32/cryp - Fix PM reference leak...") Fixes: 1cb3ad7 ("crypto: stm32/hash - Fix PM reference leak...") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 1f5b818 commit b35263f

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,8 @@ static int stm32_cryp_hw_init(struct stm32_cryp *cryp)
529529
{
530530
int ret;
531531
u32 cfg, hw_mode;
532-
pm_runtime_resume_and_get(cryp->dev);
532+
533+
pm_runtime_get_sync(cryp->dev);
533534

534535
/* Disable interrupt */
535536
stm32_cryp_write(cryp, CRYP_IMSCR, 0);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ static void stm32_hash_finish_req(struct ahash_request *req, int err)
812812
static int stm32_hash_hw_init(struct stm32_hash_dev *hdev,
813813
struct stm32_hash_request_ctx *rctx)
814814
{
815-
pm_runtime_resume_and_get(hdev->dev);
815+
pm_runtime_get_sync(hdev->dev);
816816

817817
if (!(HASH_FLAGS_INIT & hdev->flags)) {
818818
stm32_hash_write(hdev, HASH_CR, HASH_CR_INIT);
@@ -961,7 +961,7 @@ static int stm32_hash_export(struct ahash_request *req, void *out)
961961
u32 *preg;
962962
unsigned int i;
963963

964-
pm_runtime_resume_and_get(hdev->dev);
964+
pm_runtime_get_sync(hdev->dev);
965965

966966
while ((stm32_hash_read(hdev, HASH_SR) & HASH_SR_BUSY))
967967
cpu_relax();
@@ -999,7 +999,7 @@ static int stm32_hash_import(struct ahash_request *req, const void *in)
999999

10001000
preg = rctx->hw_context;
10011001

1002-
pm_runtime_resume_and_get(hdev->dev);
1002+
pm_runtime_get_sync(hdev->dev);
10031003

10041004
stm32_hash_write(hdev, HASH_IMR, *preg++);
10051005
stm32_hash_write(hdev, HASH_STR, *preg++);

0 commit comments

Comments
 (0)