Add the missing clk_disable_unprepare() before return in stm32_hwspinlock_probe(). Signed-off-by: Gaosheng Cui <cuigaosheng1@xxxxxxxxxx> --- drivers/hwspinlock/stm32_hwspinlock.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/hwspinlock/stm32_hwspinlock.c b/drivers/hwspinlock/stm32_hwspinlock.c index bb5c7e5f7a80..a4e3b9a9e29d 100644 --- a/drivers/hwspinlock/stm32_hwspinlock.c +++ b/drivers/hwspinlock/stm32_hwspinlock.c @@ -103,6 +103,7 @@ static int stm32_hwspinlock_probe(struct platform_device *pdev) ret = devm_add_action_or_reset(dev, stm32_hwspinlock_disable_clk, pdev); if (ret) { dev_err(dev, "Failed to register action\n"); + clk_disable_unprepare(hw->clk); return ret; } @@ -112,8 +113,10 @@ static int stm32_hwspinlock_probe(struct platform_device *pdev) ret = devm_hwspin_lock_register(dev, &hw->bank, &stm32_hwspinlock_ops, 0, STM32_MUTEX_NUM_LOCKS); - if (ret) + if (ret) { dev_err(dev, "Failed to register hwspinlock\n"); + clk_disable_unprepare(hw->clk); + } return ret; } -- 2.25.1