]> git.hungrycats.org Git - linux/commitdiff
[PATCH] APM: handle kernel_thread failure
authorAndrew Morton <akpm@osdl.org>
Tue, 20 Jan 2004 11:15:00 +0000 (03:15 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 20 Jan 2004 11:15:00 +0000 (03:15 -0800)
From: "Randy.Dunlap" <rddunlap@osdl.org>
From: Eugene TEO <eugeneteo@eugeneteo.net>

arch/i386/kernel/apm.c

index 036a2a4d73a1f6f2f1defad3c6cb552bff0f685c..c5ccd406962b70f642c5392d3220714ce9e5e12d 100644 (file)
@@ -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