Avoided crashes on kernel 2.4 acc. to patch by M. Schwerin.
authorFlorian Pose <fp@igh-essen.com>
Thu, 06 Jul 2006 08:39:48 +0000
changeset 296 967aaacf9b20
parent 295 934ec4051dd4
child 297 ac2a057a8ef2
child 1714 f149465f4c63
Avoided crashes on kernel 2.4 acc. to patch by M. Schwerin.
master/slave.c
--- a/master/slave.c	Thu Jul 06 08:38:08 2006 +0000
+++ b/master/slave.c	Thu Jul 06 08:39:48 2006 +0000
@@ -539,7 +539,7 @@
 
     word_offset = 0x0040;
 
-    if (!(cat_data = (uint8_t *) kmalloc(0x10000, GFP_KERNEL))) {
+    if (!(cat_data = (uint8_t *) kmalloc(0x10000, GFP_ATOMIC))) {
         EC_ERR("Failed to allocate 64k bytes for category data.\n");
         return -1;
     }
@@ -637,7 +637,7 @@
         size = data[offset];
         // allocate memory for string structure and data at a single blow
         if (!(string = (ec_eeprom_string_t *)
-              kmalloc(sizeof(ec_eeprom_string_t) + size + 1, GFP_KERNEL))) {
+              kmalloc(sizeof(ec_eeprom_string_t) + size + 1, GFP_ATOMIC))) {
             EC_ERR("Failed to allocate string memory.\n");
             return -1;
         }
@@ -701,7 +701,7 @@
 
     for (i = 0; i < sync_count; i++, data += 8) {
         if (!(sync = (ec_eeprom_sync_t *)
-              kmalloc(sizeof(ec_eeprom_sync_t), GFP_KERNEL))) {
+              kmalloc(sizeof(ec_eeprom_sync_t), GFP_ATOMIC))) {
             EC_ERR("Failed to allocate Sync-Manager memory.\n");
             return -1;
         }
@@ -737,7 +737,7 @@
 
     while (word_count >= 4) {
         if (!(pdo = (ec_eeprom_pdo_t *)
-              kmalloc(sizeof(ec_eeprom_pdo_t), GFP_KERNEL))) {
+              kmalloc(sizeof(ec_eeprom_pdo_t), GFP_ATOMIC))) {
             EC_ERR("Failed to allocate PDO memory.\n");
             return -1;
         }
@@ -758,7 +758,7 @@
 
         for (i = 0; i < entry_count; i++) {
             if (!(entry = (ec_eeprom_pdo_entry_t *)
-                  kmalloc(sizeof(ec_eeprom_pdo_entry_t), GFP_KERNEL))) {
+                  kmalloc(sizeof(ec_eeprom_pdo_entry_t), GFP_ATOMIC))) {
                 EC_ERR("Failed to allocate PDO entry memory.\n");
                 return -1;
             }
@@ -808,7 +808,7 @@
     list_for_each_entry(string, &slave->eeprom_strings, list) {
         if (--index) continue;
 
-        if (!(*ptr = (char *) kmalloc(string->size + 1, GFP_KERNEL))) {
+        if (!(*ptr = (char *) kmalloc(string->size + 1, GFP_ATOMIC))) {
             EC_ERR("Unable to allocate string memory.\n");
             return -1;
         }
@@ -820,7 +820,7 @@
 
     err_string = "(string not found)";
 
-    if (!(*ptr = (char *) kmalloc(strlen(err_string) + 1, GFP_KERNEL))) {
+    if (!(*ptr = (char *) kmalloc(strlen(err_string) + 1, GFP_ATOMIC))) {
         EC_ERR("Unable to allocate string memory.\n");
         return -1;
     }