From owner-freebsd-scsi Wed Mar 14 1:35:43 2001 Delivered-To: freebsd-scsi@freebsd.org Received: from cain.gsoft.com.au (genesi.lnk.telstra.net [139.130.136.161]) by hub.freebsd.org (Postfix) with ESMTP id D151937B732; Wed, 14 Mar 2001 01:35:29 -0800 (PST) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (doconnor@cain [203.38.152.97]) by cain.gsoft.com.au (8.8.8/8.8.8) with ESMTP id UAA18536; Wed, 14 Mar 2001 20:05:28 +1030 (CST) (envelope-from doconnor@gsoft.com.au) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="_=XFMail.1.4.0.FreeBSD:010314200528:9706=_" In-Reply-To: Date: Wed, 14 Mar 2001 20:05:28 +1030 (CST) From: "Daniel O'Connor" To: "Daniel O'Connor" Subject: RE: Advansys Weirdness (tm) Cc: gibbs@freebsd.org, freebsd-scsi@freebsd.org, freebsd-stable@freebsd.org Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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