* [PATCH] pwm: img: call pm_runtime_put in pm_runtime_get_sync failed case
@ 2020-06-01 7:11 Navid Emamdoost
0 siblings, 0 replies; 3+ messages in thread
From: Navid Emamdoost @ 2020-06-01 7:11 UTC (permalink / raw)
To: Thierry Reding, Uwe Kleine-König, linux-pwm, linux-kernel
Cc: emamd001, wu000273, kjlu, smccaman, Navid Emamdoost
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 put.
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
drivers/pwm/pwm-img.c | 8 ++++++--
1 file 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);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] pwm: img: call pm_runtime_put in pm_runtime_get_sync failed case
@ 2020-06-01 8:37 ` Markus Elfring
0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2020-06-01 8:37 UTC (permalink / raw)
To: Navid Emamdoost, Thierry Reding, Uwe Kleine-König, linux-pwm
Cc: Navid Emamdoost, Kangjie Lu, Qiushi Wu, Stephen McCamant,
Dinghao Liu, linux-kernel, kernel-janitors
> 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 put.
* I suggest to adjust the word “usage_count” in this change description.
* Would you like to add the tag “Fixes” to the commit message?
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pwm: img: call pm_runtime_put in pm_runtime_get_sync failed case
@ 2020-06-01 8:37 ` Markus Elfring
0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2020-06-01 8:37 UTC (permalink / raw)
To: Navid Emamdoost, Thierry Reding, Uwe Kleine-König, linux-pwm
Cc: Navid Emamdoost, Kangjie Lu, Qiushi Wu, Stephen McCamant,
Dinghao Liu, linux-kernel, kernel-janitors
> 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 put.
* I suggest to adjust the word “usage_count” in this change description.
* Would you like to add the tag “Fixes” to the commit message?
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-01 8:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01 7:11 [PATCH] pwm: img: call pm_runtime_put in pm_runtime_get_sync failed case Navid Emamdoost
2020-06-01 8:37 Markus Elfring
2020-06-01 8:37 ` Markus Elfring
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.