diff -ur rtai-3.0-test3-vanilla/rtai-core/sched/rtai/sched_lxrt.c rtai-3.0-test3/rtai-core/sched/rtai/sched_lxrt.c
--- rtai-3.0-test3-vanilla/rtai-core/sched/rtai/sched_lxrt.c	2003-12-01 10:28:43.000000000 -0200
+++ rtai-3.0-test3/rtai-core/sched/rtai/sched_lxrt.c	2004-01-07 14:22:14.000000000 -0200
@@ -213,7 +213,7 @@
 
 #define BROADCAST_TO_LOCAL_TIMERS()
 
-#define rt_request_sched_ipi()
+#define rt_request_sched_ipi() 0
 
 #define rt_free_sched_ipi()
 
@@ -1414,8 +1414,9 @@
 
 int init_module(void)
 {
-	int cpuid;
+	int cpuid, retval;
 	sched_mem_init();
+
 	for (cpuid = 0; cpuid < NR_RT_CPUS; cpuid++) {
 		rt_linux_task.uses_fpu = 1;
 		rt_linux_task.magic = 0;
@@ -1453,7 +1454,10 @@
 						 1000000000);
 	tuned.timers_tol[0] = 0;
 #ifdef CONFIG_PROC_FS
-	rtai_proc_sched_register();
+	if (rtai_proc_sched_register()) {
+		retval = 1;
+		goto mem_end;
+	}
 #endif
 	printk("\n***** STARTING THE LXRT REAL TIME SCHEDULER *****");
 	printk("\n***<> LINUX TICK AT %d (HZ) <>***", HZ);
@@ -1471,12 +1475,15 @@
 // 0x7dd763ad == nam2num("MEMSRQ").
 	if ((frstk_srq.srq = rt_request_srq(0x7dd763ad, frstk_srq_handler, 0)) < 0) {
 		printk("MEM SRQ: no sysrq available.\n");
-		return frstk_srq.srq;
+		retval = frstk_srq.srq;
+		goto umount_rtai;
 	}
 	frstk_srq.in = frstk_srq.out = 0;
-	rt_request_sched_ipi();
+	if ((retval = rt_request_sched_ipi()) != 0)
+		goto free_srq;
 
-	linux_sched_init_module();
+	if ((retval = linux_sched_init_module()) != 0)
+		goto free_sched_ipi;
 
 #ifdef CONFIG_RTAI_SCHED_ISR_LOCK
 	rt_set_ihook(&rtai_handle_isched_lock);
@@ -1484,7 +1491,21 @@
 
 	register_reboot_notifier(&lxrt_notifier_reboot);
 
-	return rtai_init_features(); /* see rtai_schedcore.h */
+	retval = rtai_init_features(); /* see rtai_schedcore.h */
+exit:
+	return retval;
+free_sched_ipi:
+	rt_free_sched_ipi();
+free_srq:
+	rt_free_srq(frstk_srq.srq);
+umount_rtai:
+	rt_umount_rtai();
+#ifdef CONFIG_PROC_FS
+	rtai_proc_sched_unregister();
+#endif
+mem_end:
+	sched_mem_end();
+	goto exit;
 }
 
 void cleanup_module(void)

