Re: [PATCH v2 2/2] clk: aspeed: Prevent reset if clock is enabled

From: Lei YU
Date: Thu Mar 08 2018 - 22:23:17 EST


> static int aspeed_clk_enable(struct clk_hw *hw)
> {
> struct aspeed_clk_gate *gate = to_aspeed_clk_gate(hw);
> @@ -215,6 +227,11 @@ static int aspeed_clk_enable(struct clk_hw *hw)
>
> spin_lock_irqsave(gate->lock, flags);
>
> + if (aspeed_clk_is_enabled(hw)) {
> + spin_unlock_irqrestore(gate->lock, flags);
> + return 0;
> + }
> +

I think this piece of code can be run before spin_lock_irqsave(), so it is
able to just return without spin_unlock_irqrestore()?