hwspinlock: sprd: Check the return value of clk_prepare_enable()
authorBaolin Wang <baolin.wang@linaro.org>
Fri, 27 Sep 2019 07:10:45 +0000 (15:10 +0800)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Sat, 5 Oct 2019 04:07:44 +0000 (21:07 -0700)
We must check the return value of clk_prepare_enable() to make sure the
hardware spinlock controller can be enabled successfully, otherwise we
should return error.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/hwspinlock/sprd_hwspinlock.c

index 7a8534f..d210424 100644 (file)
@@ -105,7 +105,9 @@ static int sprd_hwspinlock_probe(struct platform_device *pdev)
                return PTR_ERR(sprd_hwlock->clk);
        }
 
-       clk_prepare_enable(sprd_hwlock->clk);
+       ret = clk_prepare_enable(sprd_hwlock->clk);
+       if (ret)
+               return ret;
 
        /* set the hwspinlock to record user id to identify subsystems */
        writel(HWSPINLOCK_USER_BITS, sprd_hwlock->base + HWSPINLOCK_RECCTRL);