patch-2.4.0-test11 linux/drivers/scsi/eata_dma.c

Next file: linux/drivers/scsi/eata_dma_proc.c
Previous file: linux/drivers/scsi/dtc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test10/linux/drivers/scsi/eata_dma.c linux/drivers/scsi/eata_dma.c
@@ -554,7 +554,17 @@
 				  GFP_ATOMIC | GFP_DMA);
 	}
 	if (ccb->sg_list == NULL)
-	    panic("eata_dma: Run out of DMA memory for SG lists !\n");
+	{
+	    /*
+	     *	Claim the bus was busy. Actually we are the problem but this
+	     *  will do a deferred retry for us ;)
+	     */
+	    printk(KERN_ERR "eata_dma: Run out of DMA memory for SG lists !\n");
+	    cmd->result = DID_BUS_BUSY << 16;
+	    ccb->status = FREE;    
+	    done(cmd);
+	    return(0);
+	}
 	ccb->cp_dataDMA = htonl(virt_to_bus(ccb->sg_list)); 
 	
 	ccb->cp_datalen = htonl(cmd->use_sg * sizeof(struct eata_sg_list));
@@ -909,8 +919,17 @@
 
     cp = (struct eata_ccb *) kmalloc(sizeof(struct eata_ccb),
 				     GFP_ATOMIC | GFP_DMA);
+				     
+    if(cp==NULL)
+    	return NULL;
+    	
     sp = (struct eata_sp *) kmalloc(sizeof(struct eata_sp), 
 					     GFP_ATOMIC | GFP_DMA);
+    if(sp==NULL)
+    {
+        kfree(cp);
+        return NULL;
+    }				  
 
     buff = dma_scratch;
  
@@ -1463,6 +1482,10 @@
 
     if(status == NULL || dma_scratch == NULL) {
 	printk("eata_dma: can't allocate enough memory to probe for hosts !\n");
+	if(status)
+		kfree(status);
+	if(dma_scratch)
+		kfree(dma_scratch);
 	return(0);
     }
 

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