summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_bge.c
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2005-12-28 20:46:16 +0000
committerBrad Smith <brad@cvs.openbsd.org>2005-12-28 20:46:16 +0000
commit3f0c4ca6296d5ec4706edf6976987328f125adb2 (patch)
treeff34514d9bb6f07b90f15573a3a42587ed1faf65 /sys/dev/pci/if_bge.c
parent1603fd8147def67d24a6094904918972b5b83f28 (diff)
Fix bge_eeprom_getbyte() to return 1 when timeout happens.
Previously it always returned 0 which means success regardless of EEPROM status. While here, add a check whether EEPROM read is successful. From yongari FreeBSD
Diffstat (limited to 'sys/dev/pci/if_bge.c')
-rw-r--r--sys/dev/pci/if_bge.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index 11d09b0f83d..21e1d853a19 100644
--- a/sys/dev/pci/if_bge.c
+++ b/sys/dev/pci/if_bge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bge.c,v 1.117 2005/12/28 20:27:38 brad Exp $ */
+/* $OpenBSD: if_bge.c,v 1.118 2005/12/28 20:46:15 brad Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -502,7 +502,7 @@ bge_eeprom_getbyte(struct bge_softc *sc, int addr, u_int8_t *dest)
if (i == BGE_TIMEOUT * 10) {
printf("%s: eeprom read timed out\n", sc->bge_dev.dv_xname);
- return (0);
+ return (1);
}
/* Get result. */
@@ -1900,8 +1900,11 @@ bge_attach(struct device *parent, struct device *self, void *aux)
if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) == BGE_MAGIC_NUMBER)
hwcfg = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG);
else {
- bge_read_eeprom(sc, (caddr_t)&hwcfg, BGE_EE_HWCFG_OFFSET,
- sizeof(hwcfg));
+ if (bge_read_eeprom(sc, (caddr_t)&hwcfg, BGE_EE_HWCFG_OFFSET,
+ sizeof(hwcfg))) {
+ printf(": failed to read media type\n");
+ goto fail_5;
+ }
hwcfg = ntohl(hwcfg);
}