Skip to contentSkip to conversation

caamalg: Make use of dev_*() instead of pr_*()

PATCH In review Ben Collins 2 participants 2 messages Apr 22, 2025 – Apr 23, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 caamalg: Make use of dev_*() instead of pr_*()

It's nice when messages line up with the device, and easy to implement since it's already available in the functions.

Cc "Horia Geantă" <[email protected]>
Cc Pankaj Gupta <[email protected]>
Cc Gaurav Jain <[email protected]>
Cc Herbert Xu <[email protected]>
Cc "David S. Miller" <[email protected]>
---
 drivers/crypto/caam/caamalg.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/crypto/caam/caamalg.c +6 -6
index 2cfb1b8d8c7cf..d964a62ef9668 100644
@@ -3633,7 +3633,7 @@ static int caam_cra_init(struct crypto_skcipher *tfm)
 		fallback = crypto_alloc_skcipher(tfm_name, 0,
 						 CRYPTO_ALG_NEED_FALLBACK);
 		if (IS_ERR(fallback)) {
-			pr_err("Failed to allocate %s fallback: %ld\n",
+			dev_err(ctx->jrdev, "Failed to allocate %s fallback: %ld\n",
 			       tfm_name, PTR_ERR(fallback));
 			return PTR_ERR(fallback);
 		}
@@ -3814,8 +3814,8 @@ int caam_algapi_init(struct device *ctrldev)
 
 		err = crypto_engine_register_skcipher(&t_alg->skcipher);
 		if (err) {
-			pr_warn("%s alg registration failed\n",
-				t_alg->skcipher.base.base.cra_driver_name);
+			dev_warn(ctrldev, "%s alg registration failed\n",
+				 t_alg->skcipher.base.base.cra_driver_name);
 			continue;
 		}
 
@@ -3866,8 +3866,8 @@ int caam_algapi_init(struct device *ctrldev)
 
 		err = crypto_engine_register_aead(&t_alg->aead);
 		if (err) {
-			pr_warn("%s alg registration failed\n",
-				t_alg->aead.base.base.cra_driver_name);
+			dev_warn(ctrldev, "%s alg registration failed\n",
+				 t_alg->aead.base.base.cra_driver_name);
 			continue;
 		}
 
@@ -3876,7 +3876,7 @@ int caam_algapi_init(struct device *ctrldev)
 	}
 
 	if (registered)
-		pr_info("caam algorithms registered in /proc/crypto\n");
+		dev_info(ctrldev, "caam algorithms registered in /proc/crypto\n");
 
 	return err;
 }
Signature · 9 lines
2.49.0


-- 
 Ben Collins
 https://libjwt.io
 https://github.com/benmcollins
 --
 3EC9 7598 1672 961A 1139  173A 5D5A 57C7 242B 22CF
maintainer
#1 lore raw
Quoted 20 lines · Ben Collins

It's nice when messages line up with the device, and easy to implement since it's already available in the functions.

Cc "Horia Geantă" <[email protected]>
Cc Pankaj Gupta <[email protected]>
Cc Gaurav Jain <[email protected]>
Cc Herbert Xu <[email protected]>
Cc "David S. Miller" <[email protected]>
---
 drivers/crypto/caam/caamalg.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/crypto/caam/caamalg.c +0 -0
index 2cfb1b8d8c7cf..d964a62ef9668 100644

drivers/crypto/caam/caamalg.c static int caam_cra_init(struct crypto_skcipher *tfm) · line 3636

Quoted 5 lines
drivers/crypto/caam/caamalg.c +1 -1
@@ -3633,7 +3633,7 @@ static int caam_cra_init(struct crypto_skcipher *tfm)
 		fallback = crypto_alloc_skcipher(tfm_name, 0,
 						 CRYPTO_ALG_NEED_FALLBACK);
 		if (IS_ERR(fallback)) {
-			pr_err("Failed to allocate %s fallback: %ld\n",
+			dev_err(ctx->jrdev, "Failed to allocate %s fallback: %ld\n",

ctx->jrdev is not initialized at this point;
it's done later in caam_init_common().

Actually, we've fixed the same issue some time ago in commit ab95bd2aa904 ("crypto: caam - fix printing on xts fallback allocation error path")

Thanks,
Horia