linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] crypto: ccree - fix runtime PM imbalance on error
       [not found] <20200815032755.6646-1-dinghao.liu@zju.edu.cn>
@ 2020-08-21  8:00 ` Herbert Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2020-08-21  8:00 UTC (permalink / raw)
  To: Dinghao Liu
  Cc: kjlu, Gilad Ben-Yossef, David S. Miller, Geert Uytterhoeven,
	linux-crypto, linux-kernel

On Sat, Aug 15, 2020 at 11:27:55AM +0800, Dinghao Liu wrote:
> pm_runtime_get_sync() increments the runtime PM usage counter
> even when it returns an error code. However, users of cc_pm_get(),
> a direct wrapper of pm_runtime_get_sync(), assume that PM usage
> counter will not change on error. Thus a pairing decrement is needed
> on the error handling path to keep the counter balanced.
> 
> Fixes: 8c7849a30255c ("crypto: ccree - simplify Runtime PM handling")
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>  drivers/crypto/ccree/cc_pm.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Your patch didn't make it to the list or patchwork.  Please resubmit.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: [PATCH] crypto: ccree - fix runtime PM imbalance on error
  2020-08-21  8:15 dinghao.liu
@ 2020-08-28  7:19 ` Herbert Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2020-08-28  7:19 UTC (permalink / raw)
  To: dinghao.liu
  Cc: kjlu, Gilad Ben-Yossef, David S. Miller, Geert Uytterhoeven,
	linux-crypto, linux-kernel

On Fri, Aug 21, 2020 at 04:15:13PM +0800, dinghao.liu@zju.edu.cn wrote:
> pm_runtime_get_sync() increments the runtime PM usage counter
> even when it returns an error code. However, users of cc_pm_get(),
> a direct wrapper of pm_runtime_get_sync(), assume that PM usage
> counter will not change on error. Thus a pairing decrement is needed
> on the error handling path to keep the counter balanced.
> 
> Fixes: 8c7849a30255c ("crypto: ccree - simplify Runtime PM handling")
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>  drivers/crypto/ccree/cc_pm.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* [PATCH] crypto: ccree - fix runtime PM imbalance on error
@ 2020-08-21  8:15 dinghao.liu
  2020-08-28  7:19 ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: dinghao.liu @ 2020-08-21  8:15 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Gilad Ben-Yossef, Herbert Xu, David S. Miller,
	Geert Uytterhoeven, linux-crypto, linux-kernel

pm_runtime_get_sync() increments the runtime PM usage counter
even when it returns an error code. However, users of cc_pm_get(),
a direct wrapper of pm_runtime_get_sync(), assume that PM usage
counter will not change on error. Thus a pairing decrement is needed
on the error handling path to keep the counter balanced.

Fixes: 8c7849a30255c ("crypto: ccree - simplify Runtime PM handling")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/crypto/ccree/cc_pm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/ccree/cc_pm.c b/drivers/crypto/ccree/cc_pm.c
index d39e1664fc7e..3c65bf070c90 100644
--- a/drivers/crypto/ccree/cc_pm.c
+++ b/drivers/crypto/ccree/cc_pm.c
@@ -65,8 +65,12 @@ const struct dev_pm_ops ccree_pm = {
 int cc_pm_get(struct device *dev)
 {
 	int rc = pm_runtime_get_sync(dev);
+	if (rc < 0) {
+		pm_runtime_put_noidle(dev);
+		return rc;
+	}
 
-	return (rc == 1 ? 0 : rc);
+	return 0;
 }
 
 void cc_pm_put_suspend(struct device *dev)
-- 
2.17.1

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

end of thread, other threads:[~2020-08-28  7:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200815032755.6646-1-dinghao.liu@zju.edu.cn>
2020-08-21  8:00 ` [PATCH] crypto: ccree - fix runtime PM imbalance on error Herbert Xu
2020-08-21  8:15 dinghao.liu
2020-08-28  7:19 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).