diff options
author | Arvind Yadav <arvind.yadav.cs@gmail.com> | 2018-03-08 10:57:37 +0100 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2018-03-28 01:18:53 +0200 |
commit | 8bbf5b426160343b554117eb9abdf4dad9a50e65 (patch) | |
tree | 5c83efe0fb5d3bc294fa8ac2fc0ec16aa02815df /drivers/pwm | |
parent | dt-bindings: pwm: sunxi: Add new compatible strings (diff) | |
download | linux-8bbf5b426160343b554117eb9abdf4dad9a50e65.tar.xz linux-8bbf5b426160343b554117eb9abdf4dad9a50e65.zip |
pwm: sysfs: Use put_device() instead of kfree()
Never directly free @dev after calling device_register(), even if it
returned an error! Always use put_device() to give up the reference
initialized.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/pwm')
-rw-r--r-- | drivers/pwm/sysfs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/pwm/sysfs.c b/drivers/pwm/sysfs.c index 83f2b0b15712..7c71cdb8a9d8 100644 --- a/drivers/pwm/sysfs.c +++ b/drivers/pwm/sysfs.c @@ -273,7 +273,8 @@ static int pwm_export_child(struct device *parent, struct pwm_device *pwm) ret = device_register(&export->child); if (ret) { clear_bit(PWMF_EXPORTED, &pwm->flags); - kfree(export); + put_device(&export->child); + export = NULL; return ret; } |