summaryrefslogtreecommitdiff
path: root/drivers/pwm/pwm-img.c
diff options
context:
space:
mode:
authorNavid Emamdoost <navid.emamdoost@gmail.com>2020-06-01 10:11:16 +0300
committerThierry Reding <thierry.reding@gmail.com>2020-06-02 16:50:51 +0300
commitca162ce98110b98e7d97b7157328d34dcfdd40a9 (patch)
tree2ec541de3f3861ee5a350f164e2881e5981ad054 /drivers/pwm/pwm-img.c
parent1d7796bdb63a63c9cc8087ffc6daeb36a7c005e1 (diff)
downloadlinux-ca162ce98110b98e7d97b7157328d34dcfdd40a9.tar.xz
pwm: img: Call pm_runtime_put() in pm_runtime_get_sync() failed case
Even in failed case of pm_runtime_get_sync(), the usage_count is incremented. In order to keep the usage_count with correct value call appropriate pm_runtime_put(). Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/pwm/pwm-img.c')
-rw-r--r--drivers/pwm/pwm-img.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c
index c9e57bd109fb..599a0f66a384 100644
--- a/drivers/pwm/pwm-img.c
+++ b/drivers/pwm/pwm-img.c
@@ -129,8 +129,10 @@ static int img_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
duty = DIV_ROUND_UP(timebase * duty_ns, period_ns);
ret = pm_runtime_get_sync(chip->dev);
- if (ret < 0)
+ if (ret < 0) {
+ pm_runtime_put_autosuspend(chip->dev);
return ret;
+ }
val = img_pwm_readl(pwm_chip, PWM_CTRL_CFG);
val &= ~(PWM_CTRL_CFG_DIV_MASK << PWM_CTRL_CFG_DIV_SHIFT(pwm->hwpwm));
@@ -331,8 +333,10 @@ static int img_pwm_remove(struct platform_device *pdev)
int ret;
ret = pm_runtime_get_sync(&pdev->dev);
- if (ret < 0)
+ if (ret < 0) {
+ pm_runtime_put(&pdev->dev);
return ret;
+ }
for (i = 0; i < pwm_chip->chip.npwm; i++) {
val = img_pwm_readl(pwm_chip, PWM_CTRL_CFG);