[RESEND PATCH 2/2] crypto: caam - Support deferred probing in JR dependent drivers

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

 



It is possible, that caam_jr_alloc() is called before JR devices are
probed. Return -EPROBE_DEFER in drivers that rely on JR devices, so
they are probed at later stage.

Signed-off-by: Marcin Niestroj <m.niestroj@xxxxxxxxxxxxxxxx>
---
 drivers/crypto/caam/caamalg.c    | 3 +++
 drivers/crypto/caam/caamalg_qi.c | 3 +++
 drivers/crypto/caam/caamhash.c   | 3 +++
 drivers/crypto/caam/caampkc.c    | 3 +++
 drivers/crypto/caam/caamrng.c    | 3 +++
 5 files changed, 15 insertions(+)

diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index d67667970f7e..610a3f72ac5d 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -3253,6 +3253,9 @@ static int caam_init_common(struct caam_ctx *ctx, struct caam_alg_entry *caam,
 
 	ctx->jrdev = caam_jr_alloc();
 	if (IS_ERR(ctx->jrdev)) {
+		if (PTR_ERR(ctx->jrdev))
+			return -EPROBE_DEFER;
+
 		pr_err("Job Ring Device allocation for transform failed\n");
 		return PTR_ERR(ctx->jrdev);
 	}
diff --git a/drivers/crypto/caam/caamalg_qi.c b/drivers/crypto/caam/caamalg_qi.c
index 6e61cc93c2b0..85c69a8b5126 100644
--- a/drivers/crypto/caam/caamalg_qi.c
+++ b/drivers/crypto/caam/caamalg_qi.c
@@ -2547,6 +2547,9 @@ static int caam_init_common(struct caam_ctx *ctx, struct caam_alg_entry *caam,
 	 */
 	ctx->jrdev = caam_jr_alloc();
 	if (IS_ERR(ctx->jrdev)) {
+		if (PTR_ERR(ctx->jrdev))
+			return -EPROBE_DEFER;
+
 		pr_err("Job Ring Device allocation for transform failed\n");
 		return PTR_ERR(ctx->jrdev);
 	}
diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c
index 0beb28196e20..c2ccb802b7d5 100644
--- a/drivers/crypto/caam/caamhash.c
+++ b/drivers/crypto/caam/caamhash.c
@@ -1746,6 +1746,9 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm)
 	 */
 	ctx->jrdev = caam_jr_alloc();
 	if (IS_ERR(ctx->jrdev)) {
+		if (PTR_ERR(ctx->jrdev))
+			return -EPROBE_DEFER;
+
 		pr_err("Job Ring Device allocation for transform failed\n");
 		return PTR_ERR(ctx->jrdev);
 	}
diff --git a/drivers/crypto/caam/caampkc.c b/drivers/crypto/caam/caampkc.c
index 578ea63a3109..072da03207a1 100644
--- a/drivers/crypto/caam/caampkc.c
+++ b/drivers/crypto/caam/caampkc.c
@@ -972,6 +972,9 @@ static int caam_rsa_init_tfm(struct crypto_akcipher *tfm)
 	ctx->dev = caam_jr_alloc();
 
 	if (IS_ERR(ctx->dev)) {
+		if (PTR_ERR(ctx->dev))
+			return -EPROBE_DEFER;
+
 		pr_err("Job Ring Device allocation for transform failed\n");
 		return PTR_ERR(ctx->dev);
 	}
diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c
index fde07d4ff019..56616b94416b 100644
--- a/drivers/crypto/caam/caamrng.c
+++ b/drivers/crypto/caam/caamrng.c
@@ -340,6 +340,9 @@ static int __init caam_rng_init(void)
 
 	dev = caam_jr_alloc();
 	if (IS_ERR(dev)) {
+		if (PTR_ERR(dev))
+			return -EPROBE_DEFER;
+
 		pr_err("Job Ring Device allocation for transform failed\n");
 		return PTR_ERR(dev);
 	}
-- 
2.18.0




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux