Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Fix a bug that wm_attach() fails after reading M...
details: https://anonhg.NetBSD.org/src/rev/87005c877f5d
branches: trunk
changeset: 755910:87005c877f5d
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Mon Jun 28 01:43:39 2010 +0000
description:
Fix a bug that wm_attach() fails after reading MAC address. Fixes PR#43533.
Fix an uninitialized value on some cases.
diffstat:
sys/dev/pci/if_wm.c | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diffs (56 lines):
diff -r 53d2b1f4d6ec -r 87005c877f5d sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c Mon Jun 28 00:47:53 2010 +0000
+++ b/sys/dev/pci/if_wm.c Mon Jun 28 01:43:39 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wm.c,v 1.209 2010/06/25 04:35:54 msaitoh Exp $ */
+/* $NetBSD: if_wm.c,v 1.210 2010/06/28 01:43:39 msaitoh Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.209 2010/06/25 04:35:54 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.210 2010/06/28 01:43:39 msaitoh Exp $");
#include "rnd.h"
@@ -1607,10 +1607,11 @@
KASSERT(prop_data_size(ea) == ETHER_ADDR_LEN);
memcpy(enaddr, prop_data_data_nocopy(ea), ETHER_ADDR_LEN);
} else {
- if (wm_read_mac_addr(sc, enaddr) != 0)
+ if (wm_read_mac_addr(sc, enaddr) != 0) {
aprint_error_dev(sc->sc_dev,
"unable to read Ethernet address\n");
- return;
+ return;
+ }
}
aprint_normal_dev(sc->sc_dev, "Ethernet address %s\n",
@@ -4701,12 +4702,10 @@
wm_read_mac_addr(struct wm_softc *sc, uint8_t *enaddr)
{
uint16_t myea[ETHER_ADDR_LEN / 2];
- uint16_t offset;
+ uint16_t offset = EEPROM_OFF_MACADDR;
int do_invert = 0;
- if (sc->sc_funcid == 0)
- offset = EEPROM_OFF_MACADDR;
- else {
+ if (sc->sc_funcid != 0)
switch (sc->sc_type) {
case WM_T_82580:
case WM_T_82580ER:
@@ -4763,7 +4762,7 @@
do_invert = 1;
break;
}
- }
+
do_read:
if (wm_read_eeprom(sc, offset, sizeof(myea) / sizeof(myea[0]),
myea) != 0) {
Home |
Main Index |
Thread Index |
Old Index