From 3f0c4ca6296d5ec4706edf6976987328f125adb2 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Wed, 28 Dec 2005 20:46:16 +0000 Subject: 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 --- sys/dev/pci/if_bge.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sys/dev/pci/if_bge.c') 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); } -- cgit v1.2.3