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:
Родитель
8422c7439e
Коммит
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;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче