From a71c4a2675a6768498168e59402b60c94b693d23 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 20 Jan 2004 03:15:00 -0800 Subject: [PATCH] [PATCH] APM: handle kernel_thread failure From: "Randy.Dunlap" From: Eugene TEO --- arch/i386/kernel/apm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c index 036a2a4d73a1f..c5ccd406962b7 100644 --- a/arch/i386/kernel/apm.c +++ b/arch/i386/kernel/apm.c @@ -1891,6 +1891,7 @@ static struct miscdevice apm_device = { static int __init apm_init(void) { struct proc_dir_entry *apm_proc; + int ret; int i; if (apm_info.bios.version == 0) { @@ -2008,7 +2009,11 @@ static int __init apm_init(void) if (apm_proc) apm_proc->owner = THIS_MODULE; - kernel_thread(apm, NULL, CLONE_KERNEL | SIGCHLD); + ret = kernel_thread(apm, NULL, CLONE_KERNEL | SIGCHLD); + if (ret < 0) { + printk(KERN_ERR "apm: disabled - Unable to start kernel thread.\n"); + return -ENOMEM; + } if (num_online_cpus() > 1 && !smp ) { printk(KERN_NOTICE -- 2.53.0