summaryrefslogtreecommitdiffstats
path: root/drivers/pwm/core.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2019-03-25 10:49:33 +0100
committerThierry Reding <thierry.reding@gmail.com>2019-05-09 17:09:54 +0200
commite926b12c611c2095c7976e2ed31753ad6eb5ff1a (patch)
treec0c74a6953c3949d1d5007cb4e2eb3c6dca287dd /drivers/pwm/core.c
parent738a1cfec2edb4a6c53ac34fcb29447227dd135e (diff)
downloadlinux-e926b12c611c2095c7976e2ed31753ad6eb5ff1a.tar.gz
linux-e926b12c611c2095c7976e2ed31753ad6eb5ff1a.tar.bz2
linux-e926b12c611c2095c7976e2ed31753ad6eb5ff1a.zip
pwm: Clear chip_data in pwm_put()
After a PWM is disposed by its user the per chip data becomes invalid. Clear the data in common code instead of the device drivers to get consistent behaviour. Before this patch only three of nine drivers cleaned up here. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/pwm/core.c')
-rw-r--r--drivers/pwm/core.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index 8c9200a0df5e..3998ebd51db4 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -877,6 +877,7 @@ void pwm_put(struct pwm_device *pwm)
if (pwm->chip->ops->free)
pwm->chip->ops->free(pwm->chip, pwm);
+ pwm_set_chip_data(pwm, NULL);
pwm->label = NULL;
module_put(pwm->chip->ops->owner);