mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
crypto: starfive - propagate clock and reset errors
starfive_cryp_probe() publishes the crypto device after enabling its clocks
and deasserting its reset without checking whether those operations
succeeded.
Check each hardware activation step and unwind only the resources that were
actually enabled before returning the error.
Fixes: 42ef0e944b ("crypto: starfive - Add crypto engine support")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
ace145efdd
commit
c8acdd77a6
|
|
@ -125,11 +125,12 @@ static int starfive_cryp_probe(struct platform_device *pdev)
|
|||
return ret;
|
||||
|
||||
ret = clk_prepare_enable(cryp->ahb);
|
||||
if (ret) {
|
||||
clk_disable_unprepare(cryp->hclk);
|
||||
return ret;
|
||||
}
|
||||
reset_control_deassert(cryp->rst);
|
||||
if (ret)
|
||||
goto disable_hclk;
|
||||
|
||||
ret = reset_control_deassert(cryp->rst);
|
||||
if (ret)
|
||||
goto disable_ahb;
|
||||
|
||||
spin_lock(&dev_list.lock);
|
||||
list_add(&cryp->list, &dev_list.dev_list);
|
||||
|
|
@ -177,9 +178,11 @@ static int starfive_cryp_probe(struct platform_device *pdev)
|
|||
list_del(&cryp->list);
|
||||
spin_unlock(&dev_list.lock);
|
||||
|
||||
clk_disable_unprepare(cryp->hclk);
|
||||
clk_disable_unprepare(cryp->ahb);
|
||||
reset_control_assert(cryp->rst);
|
||||
disable_ahb:
|
||||
clk_disable_unprepare(cryp->ahb);
|
||||
disable_hclk:
|
||||
clk_disable_unprepare(cryp->hclk);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user