patch-2.4.0-test11 linux/drivers/scsi/53c7xx.c

Next file: linux/drivers/scsi/AM53C974.c
Previous file: linux/drivers/scsi/3w-xxxx.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test10/linux/drivers/scsi/53c7xx.c linux/drivers/scsi/53c7xx.c
@@ -1125,6 +1125,7 @@
     int script_len = 0, dsa_len = 0, size = 0, max_cmd_size = 0,
 	schedule_size = 0, ok = 0;
     void *tmp;
+    unsigned long page;
 
     switch (chip) {
     case 710:
@@ -1191,6 +1192,12 @@
        */
 	(sizeof(void *) - sizeof(u32)) + max_cmd_size + schedule_size;
 
+    page = __get_free_pages(GFP_ATOMIC,1);
+    if(page==0)
+    {
+    	printk(KERN_ERR "53c7xx: out of memory.\n");
+    	return -ENOMEM;
+    }
 #ifdef FORCE_DSA_ALIGNMENT
     /*
      * 53c710 rev.0 doesn't have an add-with-carry instruction.
@@ -1203,10 +1210,11 @@
       panic("53c7xx: hostdata > 8K");
     instance = scsi_register (tpnt, 4);
     if (!instance)
+    {
+        free_page(page);
 	return -1;
-    instance->hostdata[0] = __get_free_pages(GFP_ATOMIC, 1);
-    if (instance->hostdata[0] == 0)
-        panic ("53c7xx: Couldn't get hostdata memory");
+    }
+    instance->hostdata[0] = page;
     memset((void *)instance->hostdata[0], 0, 8192);
     cache_push(virt_to_phys((void *)(instance->hostdata[0])), 8192);
     cache_clear(virt_to_phys((void *)(instance->hostdata[0])), 8192);
@@ -3087,7 +3095,7 @@
             panic ("53c7xx: allocate_cmd size > 4K");
         real = get_free_page(GFP_ATOMIC);
         if (real == 0)
-            panic ("53c7xx: Couldn't get memory for allocate_cmd");
+        	return NULL;
         memset((void *)real, 0, 4096);
         cache_push(virt_to_phys((void *)real), 4096);
         cache_clear(virt_to_phys((void *)real), 4096);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)