Fixed NULL pointer dereference on request error in RTAI example.
authorFlorian Pose <fp@igh-essen.com>
Tue, 01 Jun 2010 22:51:51 +0200
changeset 1935 8ea1033bd4c2
parent 1934 f00951ab7399
child 1936 356a3839837f
Fixed NULL pointer dereference on request error in RTAI example.
examples/rtai/rtai_sample.c
--- a/examples/rtai/rtai_sample.c	Tue May 25 14:12:02 2010 +0200
+++ b/examples/rtai/rtai_sample.c	Tue Jun 01 22:51:51 2010 +0200
@@ -76,8 +76,8 @@
 // process data
 static uint8_t *domain1_pd; // process data memory
 
-#define AnaInSlavePos  0, 1
-#define DigOutSlavePos 0, 3
+#define AnaInSlavePos  0, 3
+#define DigOutSlavePos 0, 2
 
 #define Beckhoff_EL2004 0x00000002, 0x07D43052
 #define Beckhoff_EL3162 0x00000002, 0x0C5A3052
@@ -286,8 +286,8 @@
     t_critical = cpu_khz * 1000 / FREQUENCY - cpu_khz * INHIBIT_TIME / 1000;
 
     master = ecrt_request_master(0);
-    if (IS_ERR(master)) {
-        ret = PTR_ERR(master); 
+    if (!master) {
+        ret = -EBUSY; 
         printk(KERN_ERR PFX "Requesting master 0 failed!\n");
         goto out_return;
     }