summaryrefslogtreecommitdiff
path: root/drivers/pwm
diff options
context:
space:
mode:
authorThierry Reding <thierry.reding@gmail.com>2019-06-26 11:36:40 +0200
committerThierry Reding <thierry.reding@gmail.com>2019-06-26 11:39:25 +0200
commit3d25025ce9c2f364ea4ee76f1461c8714b9c0b6d (patch)
tree2341105f644a9303c7c10d32ed2804b612c77129 /drivers/pwm
parenta2a28229cdce7bd4d95ecf57ea1306a9e2c10137 (diff)
pwm: fsl-ftm: Make sure to unlock mutex on failure
Upon failure to enable clocks while trying to enable the PWM, make sure to unlock the mutex that was taken to avoid a deadlock during subsequent operations. Reported-by: kbuild test robot <lkp@intel.com> Reported-by: Julia Lawall <julia.lawall@lip6.fr> Cc: Patrick Havelange <patrick.havelange@essensium.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/pwm')
-rw-r--r--drivers/pwm/pwm-fsl-ftm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pwm/pwm-fsl-ftm.c b/drivers/pwm/pwm-fsl-ftm.c
index 6a4106c65cb4..efc226bda214 100644
--- a/drivers/pwm/pwm-fsl-ftm.c
+++ b/drivers/pwm/pwm-fsl-ftm.c
@@ -342,12 +342,12 @@ static int fsl_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
if (!oldstate->enabled) {
ret = clk_prepare_enable(fpc->clk[fpc->period.clk_select]);
if (ret)
- return ret;
+ goto end_mutex;
ret = clk_prepare_enable(fpc->clk[FSL_PWM_CLK_CNTEN]);
if (ret) {
clk_disable_unprepare(fpc->clk[fpc->period.clk_select]);
- return ret;
+ goto end_mutex;
}
regmap_update_bits(fpc->regmap, FTM_OUTMASK, BIT(pwm->hwpwm),