crypto: caam - fix printing on xts fallback allocation error path
authorHoria Geantă <horia.geanta@nxp.com>
Sun, 1 Nov 2020 20:05:53 +0000 (22:05 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 6 Nov 2020 03:31:17 +0000 (14:31 +1100)
At the time xts fallback tfm allocation fails the device struct
hasn't been enabled yet in the caam xts tfm's private context.

Fix this by using the device struct from xts algorithm's private context
or, when not available, by replacing dev_err with pr_err.

Fixes: 9d9b14dbe077 ("crypto: caam/jr - add fallback for XTS with more than 8B IV")
Fixes: 83e8aa912138 ("crypto: caam/qi - add fallback for XTS with more than 8B IV")
Fixes: 36e2d7cfdcf1 ("crypto: caam/qi2 - add fallback for XTS with more than 8B IV")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/caam/caamalg.c
drivers/crypto/caam/caamalg_qi.c
drivers/crypto/caam/caamalg_qi2.c

index cf5bd7666dfcd9bb7b7c43e624d399f5b47d04dd..8697ae53b0633cb4f6dbfe6b93ea039a8574d669 100644 (file)
@@ -3404,8 +3404,8 @@ static int caam_cra_init(struct crypto_skcipher *tfm)
                fallback = crypto_alloc_skcipher(tfm_name, 0,
                                                 CRYPTO_ALG_NEED_FALLBACK);
                if (IS_ERR(fallback)) {
-                       dev_err(ctx->jrdev, "Failed to allocate %s fallback: %ld\n",
-                               tfm_name, PTR_ERR(fallback));
+                       pr_err("Failed to allocate %s fallback: %ld\n",
+                              tfm_name, PTR_ERR(fallback));
                        return PTR_ERR(fallback);
                }
 
index 66f60d78bdc84fe459b08becf624364193357a47..a24ae966df4a3080c3b7921b1824232db24097cb 100644 (file)
@@ -2502,8 +2502,8 @@ static int caam_cra_init(struct crypto_skcipher *tfm)
                fallback = crypto_alloc_skcipher(tfm_name, 0,
                                                 CRYPTO_ALG_NEED_FALLBACK);
                if (IS_ERR(fallback)) {
-                       dev_err(ctx->jrdev, "Failed to allocate %s fallback: %ld\n",
-                               tfm_name, PTR_ERR(fallback));
+                       pr_err("Failed to allocate %s fallback: %ld\n",
+                              tfm_name, PTR_ERR(fallback));
                        return PTR_ERR(fallback);
                }
 
index 98c1ff1744bb19d5e8cdb1242829fa83f6e67ab6..a780e627838ae9a3aa41835a32d353c4d4ea00ff 100644 (file)
@@ -1611,7 +1611,8 @@ static int caam_cra_init_skcipher(struct crypto_skcipher *tfm)
                fallback = crypto_alloc_skcipher(tfm_name, 0,
                                                 CRYPTO_ALG_NEED_FALLBACK);
                if (IS_ERR(fallback)) {
-                       dev_err(ctx->dev, "Failed to allocate %s fallback: %ld\n",
+                       dev_err(caam_alg->caam.dev,
+                               "Failed to allocate %s fallback: %ld\n",
                                tfm_name, PTR_ERR(fallback));
                        return PTR_ERR(fallback);
                }