Skip to contentSkip to conversation

scsi/aha1740.c Handle scsi_add_host failure

PATCH In review Ashutosh Naik 2 participants 2 messages Jan 10, 2006 – Jan 13, 2006 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi/aha1740.c Handle scsi_add_host failure

Add scsi_add_host() failure handling for Adaptec aha1740 driver.

drivers/scsi/aha1740.c +8 -2
diff -Naurp linux-2.6.15-git5-vanilla/drivers/scsi/aha1740.c linux-2.6.15-git5/drivers/scsi/aha1740.c
@@ -587,7 +587,7 @@ static struct scsi_host_template aha1740
 
 static int aha1740_probe (struct device *dev)
 {
-	int slotbase;
+	int slotbase, retval;
 	unsigned int irq_level, irq_type, translation;
 	struct Scsi_Host *shpnt;
 	struct aha1740_hostdata *host;
@@ -642,7 +642,13 @@ static int aha1740_probe (struct device 
 	}
 
 	eisa_set_drvdata (edev, shpnt);
-	scsi_add_host (shpnt, dev); /* XXX handle failure */
+	retval = scsi_add_host (shpnt, dev);
+	if (retval) {
+		printk(KERN_WARNING "aha1740: scsi_add_host failed\n");
+		scsi_host_put (shpnt);
+		return retval;
+	}
+		
 	scsi_scan_host (shpnt);
 	return 0;
 
#1 lore raw
Quoted 18 lines · Ashutosh Naik

Add scsi_add_host() failure handling for Adaptec aha1740 driver.

diff -Naurp linux-2.6.15-git5-vanilla/drivers/scsi/aha1740.c linux-2.6.15-git5/drivers/scsi/aha1740.c

drivers/scsi/aha1740.c +1 -1
@@ -587,7 +587,7 @@ static struct scsi_host_template aha1740
 
 static int aha1740_probe (struct device *dev)
 {
-	int slotbase;
+	int slotbase, retval;
 	unsigned int irq_level, irq_type, translation;
 	struct Scsi_Host *shpnt;
 	struct aha1740_hostdata *host;
@@ -642,7 +642,13 @@ static int aha1740_probe (struct device 
 	}

drivers/scsi/aha1740.c static int aha1740_probe (struct device · line 651

Quoted 10 lines
drivers/scsi/aha1740.c +7 -1
 
 	eisa_set_drvdata (edev, shpnt);
-	scsi_add_host (shpnt, dev); /* XXX handle failure */
+	retval = scsi_add_host (shpnt, dev);
+	if (retval) {
+		printk(KERN_WARNING "aha1740: scsi_add_host failed\n");
+		scsi_host_put (shpnt);
+		return retval;
+	}
+		

this is wrong. you need to add a new err_free_irq label that frees the allocated irq and then falls through to the existing error handling code, starting at the err_unmap label.