提交 8bbf5b42 编写于 作者: A Arvind Yadav 提交者: Thierry Reding

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: NArvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: NThierry Reding <thierry.reding@gmail.com>
上级 8422c743
...@@ -273,7 +273,8 @@ static int pwm_export_child(struct device *parent, struct pwm_device *pwm) ...@@ -273,7 +273,8 @@ static int pwm_export_child(struct device *parent, struct pwm_device *pwm)
ret = device_register(&export->child); ret = device_register(&export->child);
if (ret) { if (ret) {
clear_bit(PWMF_EXPORTED, &pwm->flags); clear_bit(PWMF_EXPORTED, &pwm->flags);
kfree(export); put_device(&export->child);
export = NULL;
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册