Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/dev/pci



For the record, I did not OK this commit.


--------------------------------------------------
From: "Christoph Egger" <cegger%netbsd.org@localhost>
Sent: Sunday, April 26, 2009 2:56 AM
To: <source-changes-full%NetBSD.org@localhost>
Subject: CVS commit: src/sys/dev/pci

Module Name: src
Committed By: cegger
Date: Sun Apr 26 06:56:46 UTC 2009

Modified Files:
src/sys/dev/pci: if_lii.c

Log Message:
fix error handling in lii_attach()
ok jmcneill@


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/if_lii.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.





Modified files:

Index: src/sys/dev/pci/if_lii.c
diff -u src/sys/dev/pci/if_lii.c:1.5 src/sys/dev/pci/if_lii.c:1.6
--- src/sys/dev/pci/if_lii.c:1.5 Tue Jul  8 12:39:27 2008
+++ src/sys/dev/pci/if_lii.c Sun Apr 26 06:56:46 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_lii.c,v 1.5 2008/07/08 12:39:27 sborrill Exp $ */
+/* $NetBSD: if_lii.c,v 1.6 2009/04/26 06:56:46 cegger Exp $ */

/*
 *  Copyright (c) 2008 The NetBSD Foundation.
@@ -31,7 +31,7 @@
 */

#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_lii.c,v 1.5 2008/07/08 12:39:27 sborrill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_lii.c,v 1.6 2009/04/26 06:56:46 cegger Exp $");

#include "bpfilter.h"

@@ -243,6 +243,7 @@
 pci_intr_handle_t ih;
 const char *intrstr;
 pcireg_t cmd;
+ bus_size_t memsize = 0;

 aprint_naive("\n");
 aprint_normal(": Attansic/Atheros L2 Fast Ethernet\n");
@@ -267,7 +268,7 @@
 break;
 }
 if (pci_mapreg_map(pa, PCI_MAPREG_START, cmd, 0,
-     &sc->sc_mmiot, &sc->sc_mmioh, NULL, NULL) != 0) {
+     &sc->sc_mmiot, &sc->sc_mmioh, NULL, &memsize) != 0) {
 aprint_error_dev(self, "failed to map registers\n");
 return;
 }
@@ -291,7 +292,7 @@

 if (pci_intr_map(pa, &ih) != 0) {
 aprint_error_dev(self, "failed to map interrupt\n");
- return;
+ goto fail;
 }
 intrstr = pci_intr_string(sc->sc_pc, ih);
 sc->sc_ih = pci_intr_establish(sc->sc_pc, ih, IPL_NET, lii_intr, sc);
@@ -300,14 +301,12 @@
 if (intrstr != NULL)
 aprint_error(" at %s", intrstr);
 aprint_error("\n");
- return;
+ goto fail;
 }
 aprint_normal_dev(self, "interrupting at %s\n", intrstr);

- if (lii_alloc_rings(sc)) {
- pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
- return;
- }
+ if (lii_alloc_rings(sc))
+ goto fail;

 callout_init(&sc->sc_tick_ch, 0);
 callout_setfunc(&sc->sc_tick_ch, lii_tick, sc);
@@ -347,6 +346,14 @@
 pmf_class_network_register(self, ifp);

 return;
+
+fail:
+ if (sc->sc_ih != NULL) {
+ pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
+ sc->sc_ih = NULL;
+ }
+ if (memsize)
+ bus_space_unmap(sc->sc_mmiot, sc->sc_mmioh, memsize);
}

static int




Home | Main Index | Thread Index | Old Index