提交 bc1e49df 编写于 作者: I Insu Yun 提交者: Rafael J. Wysocki

ACPI / sysfs: correctly check failing memory allocation

Since kobject_create_and_add() can fail under memory pressure,
its return value needs to be checked against NULL before passing
it to sysfs_create_file().
Signed-off-by: NInsu Yun <wuninsu@gmail.com>
[ rjw: Subject & changelog ]
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 f934c745
...@@ -878,6 +878,9 @@ int __init acpi_sysfs_init(void) ...@@ -878,6 +878,9 @@ int __init acpi_sysfs_init(void)
return result; return result;
hotplug_kobj = kobject_create_and_add("hotplug", acpi_kobj); hotplug_kobj = kobject_create_and_add("hotplug", acpi_kobj);
if (!hotplug_kobj)
return -ENOMEM;
result = sysfs_create_file(hotplug_kobj, &force_remove_attr.attr); result = sysfs_create_file(hotplug_kobj, &force_remove_attr.attr);
if (result) if (result)
return result; return result;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册