From: Etienne Carriere Date: Mon, 27 Apr 2020 06:42:24 +0000 (+0200) Subject: crypto: stm32/hash - defer probe for reset controller X-Git-Tag: v5.8-rc1~236^2~73 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=43b05ce76733164e1c1b33ab16eda14130646c96;p=thirdparty%2Fkernel%2Flinux.git crypto: stm32/hash - defer probe for reset controller Change stm32 HASH driver to defer its probe operation when reset controller device is registered but has not been probed yet. Signed-off-by: Etienne Carriere Reviewed-by: Lionel DEBIEVE Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c index 167b80eec437f..fad6190be0889 100644 --- a/drivers/crypto/stm32/stm32-hash.c +++ b/drivers/crypto/stm32/stm32-hash.c @@ -1482,7 +1482,12 @@ static int stm32_hash_probe(struct platform_device *pdev) pm_runtime_enable(dev); hdev->rst = devm_reset_control_get(&pdev->dev, NULL); - if (!IS_ERR(hdev->rst)) { + if (IS_ERR(hdev->rst)) { + if (PTR_ERR(hdev->rst) == -EPROBE_DEFER) { + ret = -EPROBE_DEFER; + goto err_reset; + } + } else { reset_control_assert(hdev->rst); udelay(2); reset_control_deassert(hdev->rst); @@ -1535,7 +1540,7 @@ err_engine: if (hdev->dma_lch) dma_release_channel(hdev->dma_lch); - +err_reset: pm_runtime_disable(dev); pm_runtime_put_noidle(dev);