pwm: fsl-ftm: Make sure to unlock mutex on failure
PATCH 1/1 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 <[email protected]>
Reported-by Julia Lawall <[email protected]>
Cc Patrick Havelange <[email protected]>
Signed-off-by Thierry Reding <[email protected]>
--- drivers/pwm/pwm-fsl-ftm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-fsl-ftm.c +2 -2
@@ -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),
Signature · 1 line
2.21.0