All of lore.kernel.org
 help / color / mirror / Atom feed
* crypto: stm32: Broken RPM changes should be reverted
@ 2021-11-27 13:39 Heiner Kallweit
  2021-12-01  6:30 ` crypto: stm32 - Revert broken pm_runtime_resume_and_get changes Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Heiner Kallweit @ 2021-11-27 13:39 UTC (permalink / raw)
  To: Shixin Liu, Herbert Xu, Rafael J. Wysocki; +Cc: Linux PM

When discussing whether pm_runtime_resume_and_get() should be annotated as
__must_check, I became aware of RPM usage in crypto/stm32.

Following two patches replace usage of pm_runtime_get_sync() with
pm_runtime_resume_and_get() w/o checking the return code.

747bf30fd944 ("crypto: stm32/cryp - Fix PM reference leak on stm32-cryp.c")
1cb3ad701970 ("crypto: stm32/hash - Fix PM reference leak on stm32-hash.c")

This results in RPM usage like the following in stm32_hash_export():

pm_runtime_resume_and_get(hdev->dev);
...
pm_runtime_mark_last_busy(hdev->dev);
pm_runtime_put_autosuspend(hdev->dev);

This is broken. After pm_runtime_resume_and_get() the usage count may be
incremented or not. If not, then the call to pm_runtime_put_autosuspend()
results in exactly the imbalance that the patch claims to fix.

Therefore I think both patches should be reverted, or the return code
of pm_runtime_resume_and_get() has to be checked and properly handled
in the driver logic.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-01 14:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-27 13:39 crypto: stm32: Broken RPM changes should be reverted Heiner Kallweit
2021-12-01  6:30 ` crypto: stm32 - Revert broken pm_runtime_resume_and_get changes Herbert Xu
2021-12-01  6:50   ` Heiner Kallweit
2021-12-01 14:46   ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.