summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2006-05-20 05:12:24 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2006-05-20 05:12:24 +0000
commita19c0de228557e263600275109a31765136d5e63 (patch)
treedd02c3c1dd28f23c83a7a68dff4597fd05cdace1 /sys/dev
parent2f92312a96e59382f17f5b5d3a6356057c874228 (diff)
fix pci resource allocation in em, don't crash!
fix by brad@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_em.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c
index 341d1d7636f..cb3e6027259 100644
--- a/sys/dev/pci/if_em.c
+++ b/sys/dev/pci/if_em.c
@@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
-/* $OpenBSD: if_em.c,v 1.121 2006/05/20 03:47:56 brad Exp $ */
+/* $OpenBSD: if_em.c,v 1.122 2006/05/20 05:12:23 reyk Exp $ */
/* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */
#include <dev/pci/if_em.h>
@@ -246,6 +246,18 @@ em_attach(struct device *parent, struct device *self, void *aux)
sc->hw.master_slave = EM_MASTER_SLAVE;
#endif
+ /*
+ * This controls when hardware reports transmit completion
+ * status.
+ */
+ sc->hw.report_tx_early = 1;
+
+ if (em_allocate_pci_resources(sc)) {
+ printf("%s: Allocation of PCI resources failed\n",
+ sc->sc_dv.dv_xname);
+ goto err_pci;
+ }
+
/* Initialize eeprom parameters */
em_init_eeprom_params(&sc->hw);
@@ -283,18 +295,6 @@ em_attach(struct device *parent, struct device *self, void *aux)
sc->hw.min_frame_size =
ETHER_MIN_LEN + ETHER_CRC_LEN;
- /*
- * This controls when hardware reports transmit completion
- * status.
- */
- sc->hw.report_tx_early = 1;
-
- if (em_allocate_pci_resources(sc)) {
- printf("%s: Allocation of PCI resources failed\n",
- sc->sc_dv.dv_xname);
- goto err_pci;
- }
-
if (sc->hw.mac_type >= em_82544)
tsize = EM_ROUNDUP(sc->num_tx_desc * sizeof(struct em_tx_desc),
EM_MAX_TXD_82544 * sizeof(struct em_tx_desc));