pwm: fsl-ftm: Make sure to unlock mutex on failure
diff mbox series

Message ID
State New
Headers show
  • pwm: fsl-ftm: Make sure to unlock mutex on failure
Related show

Commit Message

Thierry Reding June 26, 2019, 9:40 a.m. UTC
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

Reported-by: kbuild test robot <>
Reported-by: Julia Lawall <>
Cc: Patrick Havelange <>
Signed-off-by: Thierry Reding <>
 drivers/pwm/pwm-fsl-ftm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff mbox series

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) {
-			return ret;
+			goto end_mutex;
 		regmap_update_bits(fpc->regmap, FTM_OUTMASK, BIT(pwm->hwpwm),