crypto: stm32/cryp - defer probe for reset controller
authorEtienne Carriere <etienne.carriere@foss.st.com>
Tue, 30 Nov 2021 07:54:53 +0000 (08:54 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 11 Dec 2021 05:48:05 +0000 (16:48 +1100)
Change stm32 CRYP driver to defer its probe operation when
reset controller device is registered but has not been probed yet.

Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Signed-off-by: Nicolas Toromanoff <nicolas.toromanoff@foss.st.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/stm32/stm32-cryp.c

index 7389a05..dcdd313 100644 (file)
@@ -1973,7 +1973,11 @@ static int stm32_cryp_probe(struct platform_device *pdev)
        pm_runtime_enable(dev);
 
        rst = devm_reset_control_get(dev, NULL);
-       if (!IS_ERR(rst)) {
+       if (IS_ERR(rst)) {
+               ret = PTR_ERR(rst);
+               if (ret == -EPROBE_DEFER)
+                       goto err_rst;
+       } else {
                reset_control_assert(rst);
                udelay(2);
                reset_control_deassert(rst);
@@ -2024,7 +2028,7 @@ err_engine1:
        spin_lock(&cryp_list.lock);
        list_del(&cryp->list);
        spin_unlock(&cryp_list.lock);
-
+err_rst:
        pm_runtime_disable(dev);
        pm_runtime_put_noidle(dev);
        pm_runtime_disable(dev);