.. | .. |
---|
164 | 164 | WARN_ON(len > sizeof(send_obj->share_buf)) || WARN_ON(!buf)) |
---|
165 | 165 | return -EINVAL; |
---|
166 | 166 | |
---|
167 | | - mutex_lock(&scp->send_lock); |
---|
168 | | - |
---|
169 | 167 | ret = clk_prepare_enable(scp->clk); |
---|
170 | 168 | if (ret) { |
---|
171 | 169 | dev_err(scp->dev, "failed to enable clock\n"); |
---|
172 | | - goto unlock_mutex; |
---|
| 170 | + return ret; |
---|
173 | 171 | } |
---|
| 172 | + |
---|
| 173 | + mutex_lock(&scp->send_lock); |
---|
174 | 174 | |
---|
175 | 175 | /* Wait until SCP receives the last command */ |
---|
176 | 176 | timeout = jiffies + msecs_to_jiffies(2000); |
---|
.. | .. |
---|
178 | 178 | if (time_after(jiffies, timeout)) { |
---|
179 | 179 | dev_err(scp->dev, "%s: IPI timeout!\n", __func__); |
---|
180 | 180 | ret = -ETIMEDOUT; |
---|
181 | | - goto clock_disable; |
---|
| 181 | + goto unlock_mutex; |
---|
182 | 182 | } |
---|
183 | 183 | } while (readl(scp->reg_base + scp->data->host_to_scp_reg)); |
---|
184 | 184 | |
---|
.. | .. |
---|
205 | 205 | ret = 0; |
---|
206 | 206 | } |
---|
207 | 207 | |
---|
208 | | -clock_disable: |
---|
209 | | - clk_disable_unprepare(scp->clk); |
---|
210 | 208 | unlock_mutex: |
---|
211 | 209 | mutex_unlock(&scp->send_lock); |
---|
| 210 | + clk_disable_unprepare(scp->clk); |
---|
212 | 211 | |
---|
213 | 212 | return ret; |
---|
214 | 213 | } |
---|