Skip to contentSkip to conversation

crypto: omap-sham - Use pm_runtime_resume_and_get() in omap_sham_probe()

PATCH In review Shang XiaoJing 3 participants 3 messages Nov 24, 2022 – Dec 2, 2022 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: omap-sham - Use pm_runtime_resume_and_get() in omap_sham_probe()

omap_sham_probe() calls pm_runtime_get_sync() and calls pm_runtime_put_sync() latter to put usage_counter. However, pm_runtime_get_sync() will increment usage_counter even it failed. Fix it by replacing it with pm_runtime_resume_and_get() to keep usage counter balanced.

Fixes b359f034c8bf ("crypto: omap-sham - Convert to use pm_runtime API")
---
 drivers/crypto/omap-sham.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/omap-sham.c +1 -1
index 655a7f5a406a..cbeda59c6b19 100644
@@ -2114,7 +2114,7 @@ static int omap_sham_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(dev);
 
-	err = pm_runtime_get_sync(dev);
+	err = pm_runtime_resume_and_get(dev);
 	if (err < 0) {
 		dev_err(dev, "failed to get sync: %d\n", err);
 		goto err_pm;
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Shang XiaoJing

omap_sham_probe() calls pm_runtime_get_sync() and calls pm_runtime_put_sync() latter to put usage_counter. However, pm_runtime_get_sync() will increment usage_counter even it failed. Fix it by replacing it with pm_runtime_resume_and_get() to keep usage counter balanced.

Fixes b359f034c8bf ("crypto: omap-sham - Convert to use pm_runtime API")
---
 drivers/crypto/omap-sham.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/omap-sham.c +0 -0
index 655a7f5a406a..cbeda59c6b19 100644

drivers/crypto/omap-sham.c static int omap_sham_probe(struct platform_device *pdev) · line 2120

Quoted 8 lines
drivers/crypto/omap-sham.c +1 -1
@@ -2114,7 +2114,7 @@ static int omap_sham_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(dev);
 
-	err = pm_runtime_get_sync(dev);
+	err = pm_runtime_resume_and_get(dev);
 	if (err < 0) {
 		dev_err(dev, "failed to get sync: %d\n", err);
 		goto err_pm;

I do not have the hardware to test this anymore but to the best of my knowledge, this is a good change. Thanks Shang.

maintainer
#2 lore raw
In reply to Shang XiaoJing
Quoted 11 lines · Shang XiaoJing

omap_sham_probe() calls pm_runtime_get_sync() and calls pm_runtime_put_sync() latter to put usage_counter. However, pm_runtime_get_sync() will increment usage_counter even it failed. Fix it by replacing it with pm_runtime_resume_and_get() to keep usage counter balanced.

Fixes b359f034c8bf ("crypto: omap-sham - Convert to use pm_runtime API")
---
 drivers/crypto/omap-sham.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt