mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
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 <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
This commit is contained in:
parent
8422c7439e
commit
8bbf5b4261
1 changed files with 2 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue