Removed unecessary clearing of EoE handlers in master init function;
authorFlorian Pose <fp@igh-essen.com>
Fri, 16 Mar 2007 11:23:08 +0000
changeset 659 d7c5a958bad0
parent 658 898b6f6bfb50
child 660 582a90a34303
Removed unecessary clearing of EoE handlers in master init function;
fixed possible bug on failing to initialize or add master kobject.
master/master.c
--- a/master/master.c	Fri Mar 16 11:06:40 2007 +0000
+++ b/master/master.c	Fri Mar 16 11:23:08 2007 +0000
@@ -105,7 +105,6 @@
         const uint8_t *backup_mac /**< MAC address of backup device */
         )
 {
-    ec_eoe_t *eoe, *next_eoe;
     unsigned int i;
 
     master->index = index;
@@ -182,7 +181,7 @@
     ec_datagram_init(&master->fsm_datagram);
     if (ec_datagram_prealloc(&master->fsm_datagram, EC_MAX_DATA_SIZE)) {
         EC_ERR("Failed to allocate FSM datagram.\n");
-        goto out_clear_eoe;
+        goto out_clear_backup;
     }
 
     // create state machine object
@@ -197,23 +196,20 @@
     if (kobject_set_name(&master->kobj, "master%i", index)) {
         EC_ERR("Failed to set master kobject name.\n");
         kobject_put(&master->kobj);
-        return -1;
+        goto out_clear_fsm;
     }
     
     if (kobject_add(&master->kobj)) {
         EC_ERR("Failed to add master kobject.\n");
         kobject_put(&master->kobj);
-        return -1;
+        goto out_clear_fsm;
     }
 
     return 0;
 
-out_clear_eoe:
-    list_for_each_entry_safe(eoe, next_eoe, &master->eoe_handlers, list) {
-        list_del(&eoe->list);
-        ec_eoe_clear(eoe);
-        kfree(eoe);
-    }
+out_clear_fsm:
+    ec_fsm_master_clear(&master->fsm);
+out_clear_backup:
     ec_device_clear(&master->backup_device);
 out_clear_main:
     ec_device_clear(&master->main_device);