Warn on duplicate master releasing.
authorFlorian Pose <fp@igh-essen.com>
Fri, 12 Jan 2007 12:10:09 +0000
changeset 531 8d9339e7453f
parent 530 3e0611dfe020
child 532 092ac0fa23fe
Warn on duplicate master releasing.
master/module.c
--- a/master/module.c	Fri Jan 12 12:09:38 2007 +0000
+++ b/master/module.c	Fri Jan 12 12:10:09 2007 +0000
@@ -471,13 +471,19 @@
 
 void ecrt_release_master(ec_master_t *master /**< EtherCAT master */)
 {
+    EC_INFO("Releasing master %i...\n", master->index);
+
+    if (master->mode != EC_MASTER_MODE_OPERATION) {
+        EC_WARN("Master %i was was not requested!\n", master->index);
+        return;
+    }
+
     ec_master_leave_operation_mode(master);
 
     module_put(master->device->module);
     atomic_inc(&master->available);
 
     EC_INFO("Released master %i.\n", master->index);
-    return;
 }
 
 /*****************************************************************************/