提交 9b41b92b 编写于 作者: A Allen Hung 提交者: Jean Delvare

dmi-id: don't free dev structure after calling device_register

dmi_dev is freed in error exit code but, according to the document
of device_register, it should never directly free device structure
after calling this function, even if it returned an error! Use
put_device() instead.
Signed-off-by: NAllen Hung <allen_hung@dell.com>
Signed-off-by: NJean Delvare <jdelvare@suse.de>
上级 d71f0586
......@@ -229,14 +229,14 @@ static int __init dmi_id_init(void)
ret = device_register(dmi_dev);
if (ret)
goto fail_free_dmi_dev;
goto fail_put_dmi_dev;
return 0;
fail_free_dmi_dev:
kfree(dmi_dev);
fail_class_unregister:
fail_put_dmi_dev:
put_device(dmi_dev);
fail_class_unregister:
class_unregister(&dmi_class);
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册