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>
This commit is contained in:
parent
8422c7439e
commit
8bbf5b4261
@ -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 New Issue
Block a user