Patch "crypto: ccree - fix runtime PM imbalance on error" has been added to the 5.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    crypto: ccree - fix runtime PM imbalance on error

to the 5.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     crypto-ccree-fix-runtime-pm-imbalance-on-error.patch
and it can be found in the queue-5.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2c58011c7e09969d48bf5a7b20143181aa7e4af1
Author: dinghao.liu@xxxxxxxxxx <dinghao.liu@xxxxxxxxxx>
Date:   Fri Aug 21 16:15:13 2020 +0800

    crypto: ccree - fix runtime PM imbalance on error
    
    [ Upstream commit b7b57a5643c2ae45afe6aa5e73363b553cacd14b ]
    
    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@xxxxxxxxxx>
    Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/crypto/ccree/cc_pm.c b/drivers/crypto/ccree/cc_pm.c
index d39e1664fc7ed..3c65bf070c908 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)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux