Minor fix: Set eeprom_size to 0 on unsuccessful memory allocation.
authorFlorian Pose <fp@igh-essen.com>
Wed, 19 Sep 2007 09:07:36 +0000
changeset 734 8c9d62f7c2cd
parent 733 222beb959fb3
child 735 0773628aabab
Minor fix: Set eeprom_size to 0 on unsuccessful memory allocation.
master/fsm_slave.c
--- a/master/fsm_slave.c	Wed Sep 19 08:24:25 2007 +0000
+++ b/master/fsm_slave.c	Wed Sep 19 09:07:36 2007 +0000
@@ -427,8 +427,9 @@
     }
 
     if (!(slave->eeprom_data =
-          (uint8_t *) kmalloc(slave->eeprom_size, GFP_ATOMIC))) {
-        fsm->slave->error_flag = 1;
+                (uint8_t *) kmalloc(slave->eeprom_size, GFP_ATOMIC))) {
+        slave->eeprom_size = 0;
+        slave->error_flag = 1;
         fsm->state = ec_fsm_slave_state_error;
         EC_ERR("Failed to allocate EEPROM data on slave %i.\n",
                slave->ring_position);