aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPyun YongHyeon <yongari@FreeBSD.org>2005-12-22 02:03:57 +0000
committerPyun YongHyeon <yongari@FreeBSD.org>2005-12-22 02:03:57 +0000
commitf6789fba469001d29a7e5e454f9788135565cb7e (patch)
tree2bf9235698167a67c7c9ea4111b33100172fdb40
parent57b183e13c1876122b363ed2d02ddfe7e52dfbb8 (diff)
downloadsrc-f6789fba469001d29a7e5e454f9788135565cb7e.tar.gz
src-f6789fba469001d29a7e5e454f9788135565cb7e.zip
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. Submitted by: jkim
Notes
Notes: svn path=/head/; revision=153629
-rw-r--r--sys/dev/bge/if_bge.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c
index 3100f93206d8..eb5ab71311ef 100644
--- a/sys/dev/bge/if_bge.c
+++ b/sys/dev/bge/if_bge.c
@@ -519,7 +519,7 @@ bge_eeprom_getbyte(sc, addr, dest)
if (i == BGE_TIMEOUT) {
printf("bge%d: eeprom read timed out\n", sc->bge_unit);
- return(0);
+ return(1);
}
/* Get result. */
@@ -2197,8 +2197,13 @@ bge_attach(dev)
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("bge%d: failed to read EEPROM\n", unit);
+ bge_release_resources(sc);
+ error = ENXIO;
+ goto fail;
+ }
hwcfg = ntohl(hwcfg);
}