[3/3] crypto: sl3516 - Use pm_runtime_resume_and_get()

Message ID 20260922031954.320895-4-phucduc.bui@gmail.com (mailing list archive)
State New
Headers
Series crypto: Use pm_runtime_resume_and_get() |

Commit Message

Bui Duc Phuc Sept. 22, 2026, 3:19 a.m. UTC
From: bui duc phuc <phucduc.bui@gmail.com>

Replace the open-coded pm_runtime_get_sync() + pm_runtime_put_noidle()
error handling pattern with pm_runtime_resume_and_get(), which already
does this internally.

No functional change.

Found by manual code inspection.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/crypto/gemini/sl3516-ce-cipher.c | 3 +--
 drivers/crypto/gemini/sl3516-ce-rng.c    | 6 ++----
 2 files changed, 3 insertions(+), 6 deletions(-)
  

Patch

diff --git a/drivers/crypto/gemini/sl3516-ce-cipher.c b/drivers/crypto/gemini/sl3516-ce-cipher.c
index 02ec4282333b..eba46aebf176 100644
--- a/drivers/crypto/gemini/sl3516-ce-cipher.c
+++ b/drivers/crypto/gemini/sl3516-ce-cipher.c
@@ -331,13 +331,12 @@  int sl3516_ce_cipher_init(struct crypto_tfm *tfm)
 		 crypto_tfm_alg_driver_name(&sktfm->base),
 		 crypto_tfm_alg_driver_name(crypto_skcipher_tfm(op->fallback_tfm)));
 
-	err = pm_runtime_get_sync(op->ce->dev);
+	err = pm_runtime_resume_and_get(op->ce->dev);
 	if (err < 0)
 		goto error_pm;
 
 	return 0;
 error_pm:
-	pm_runtime_put_noidle(op->ce->dev);
 	crypto_free_skcipher(op->fallback_tfm);
 	return err;
 }
diff --git a/drivers/crypto/gemini/sl3516-ce-rng.c b/drivers/crypto/gemini/sl3516-ce-rng.c
index 76931ec1cec5..19af03b03e42 100644
--- a/drivers/crypto/gemini/sl3516-ce-rng.c
+++ b/drivers/crypto/gemini/sl3516-ce-rng.c
@@ -24,11 +24,9 @@  static int sl3516_ce_rng_read(struct hwrng *rng, void *buf, size_t max, bool wai
 	ce->hwrng_stat_bytes += max;
 #endif
 
-	err = pm_runtime_get_sync(ce->dev);
-	if (err < 0) {
-		pm_runtime_put_noidle(ce->dev);
+	err = pm_runtime_resume_and_get(ce->dev);
+	if (err < 0)
 		return err;
-	}
 
 	while (read < max) {
 		*data = readl(ce->base + IPSEC_RAND_NUM_REG);