* [PATCH] acpi:correctly check failed allocation
@ 2015-10-15 16:19 Insu Yun
2015-10-28 3:15 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Insu Yun @ 2015-10-15 16:19 UTC (permalink / raw)
To: rjw, linux-acpi, linux-kernel; +Cc: taesoo, yeongjin.jang, insu, Insu Yun
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] acpi:correctly check failed allocation
2015-10-15 16:19 [PATCH] acpi:correctly check failed allocation Insu Yun
@ 2015-10-28 3:15 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2015-10-28 3:15 UTC (permalink / raw)
To: Insu Yun; +Cc: linux-acpi, linux-kernel, taesoo, yeongjin.jang, insu
On Thursday, October 15, 2015 12:19:30 PM Insu Yun wrote:
> 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;
>
Applied (with whitespace fixed), thanks!
Rafael
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-28 2:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-15 16:19 [PATCH] acpi:correctly check failed allocation Insu Yun
2015-10-28 3:15 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®