lkml.org 
[lkml]   [2015]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] acpi:correctly check failed allocation
Date
Since kobject_create_and_add can be failed in memory pressure,
return value need to be checked and return ENOMEM.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
drivers/acpi/sysfs.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 40a4265..e712a7b 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -878,6 +878,8 @@ int __init acpi_sysfs_init(void)
return result;

hotplug_kobj = kobject_create_and_add("hotplug", acpi_kobj);
+ if (!hotplug_kobj)
+ return -ENOMEM;
result = sysfs_create_file(hotplug_kobj, &force_remove_attr.attr);
if (result)
return result;
--
1.9.1


\
 
 \ /
  Last update: 2015-10-15 18:41    [W:0.203 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site