Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Mar 2001 20:05:28 +1030 (CST)
From:      "Daniel O'Connor" <doconnor@gsoft.com.au>
To:        "Daniel O'Connor" <doconnor@gsoft.com.au>
Cc:        gibbs@freebsd.org, freebsd-scsi@freebsd.org, freebsd-stable@freebsd.org
Subject:   RE: Advansys Weirdness (tm)
Message-ID:  <XFMail.010314200528.doconnor@gsoft.com.au>
In-Reply-To: <XFMail.010314200129.doconnor@gsoft.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
This message is in MIME format
--_=XFMail.1.4.0.FreeBSD:010314200528:9706=_
Content-Type: text/plain; charset=us-ascii


>  Attached is a diff which seems to work OK when the card firmware fails to load.
>  (As in the next KLD load doesn't die)

Whoops.. actually attach the diff this time.

---
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum

--_=XFMail.1.4.0.FreeBSD:010314200528:9706=_
Content-Disposition: attachment; filename="adw_pci_release.diff"
Content-Transfer-Encoding: 7bit
Content-Description: adw_pci_release.diff
Content-Type: text/plain;
 charset=us-ascii; name=adw_pci_release.diff; SizeOnDisk=1836

Index: adw_pci.c
===================================================================
RCS file: /local1/ncvs/src/sys/dev/advansys/adw_pci.c,v
retrieving revision 1.12.2.1
diff -u -r1.12.2.1 adw_pci.c
--- adw_pci.c	2000/08/02 22:22:40	1.12.2.1
+++ adw_pci.c	2001/03/14 09:26:38
@@ -231,16 +231,18 @@
 	}
 
 	adw = adw_alloc(dev, regs, regs_type, regs_id);
-	if (adw == NULL)
-		return(ENOMEM);
-
+	if (adw == NULL) {
+ 	        error = ENOMEM;
+		goto bailout;
+	}
+	
 	/*
 	 * Now that we have access to our registers, just verify that
 	 * this really is an AdvanSys device.
 	 */
 	if (adw_find_signature(adw) == 0) {
-		adw_free(adw);
-		return (ENXIO);
+		error = ENXIO;
+		goto bailout;
 	}
 
 	adw_reset_chip(adw);
@@ -248,7 +250,7 @@
 	error = entry->setup(dev, entry, adw);
 
 	if (error != 0)
-		return (error);
+	        goto bailout;
 
 	/* Ensure busmastering is enabled */
 	command |= PCIM_CMD_BUSMASTEREN;
@@ -272,16 +274,14 @@
 	if (error != 0) {
 		printf("%s: Could not allocate DMA tag - error %d\n",
 		       adw_name(adw), error);
-		adw_free(adw);
-		return (error);
+		goto bailout;
 	}
 
 	adw->init_level++;
 
 	error = adw_init(adw);
 	if (error != 0) {
-		adw_free(adw);
-		return (error);
+		goto bailout;
 	}
 
 	/*
@@ -300,13 +300,24 @@
 	adw->irq = bus_alloc_resource(dev, adw->irq_res_type, &zero,
 				      0, ~0, 1, RF_ACTIVE | RF_SHAREABLE);
 	if (adw->irq == NULL) {
-		adw_free(adw);
-		return (ENOMEM);
+		error = ENOMEM;
+		goto bailout;
 	}
 
 	error = adw_attach(adw);
-	if (error != 0)
-		adw_free(adw);
+
+  bailout:
+	if (error != 0) {
+		if (regs)
+		    bus_release_resource(dev, regs_type, regs_id, regs);
+		if (adw->irq) {
+		    /* teardown intr? */
+		    bus_release_resource(dev, adw->irq_res_type, 0, adw->irq);
+		}
+		if (adw)
+		    adw_free(adw);
+	}
+	
 	return (error);
 }
 

--_=XFMail.1.4.0.FreeBSD:010314200528:9706=_--
End of MIME message

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-scsi" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.010314200528.doconnor>