summaryrefslogtreecommitdiff
path: root/sys/dev/pci/eap.c
diff options
context:
space:
mode:
authorJacob Meuser <jakemsr@cvs.openbsd.org>2009-02-15 00:12:00 +0000
committerJacob Meuser <jakemsr@cvs.openbsd.org>2009-02-15 00:12:00 +0000
commit7b8cc7422b387066ebd14123cb5b2f441d7bcf0d (patch)
tree2b13cadf56ff7d163495534a8d0a43ce9b4ab254 /sys/dev/pci/eap.c
parent5975ea930ddbeda26c8432c41052ddc5c50a18d2 (diff)
avoid possibly using an uninitialized variable.
problem found by chl@, fix tested by jasper@.
Diffstat (limited to 'sys/dev/pci/eap.c')
-rw-r--r--sys/dev/pci/eap.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/dev/pci/eap.c b/sys/dev/pci/eap.c
index 1cfef2f62a2..797560bced3 100644
--- a/sys/dev/pci/eap.c
+++ b/sys/dev/pci/eap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eap.c,v 1.36 2008/12/29 22:41:45 jakemsr Exp $ */
+/* $OpenBSD: eap.c,v 1.37 2009/02/15 00:11:59 jakemsr Exp $ */
/* $NetBSD: eap.c,v 1.46 2001/09/03 15:07:37 reinoud Exp $ */
/*
@@ -413,7 +413,7 @@ u_int32_t
eap1371_src_wait(struct eap_softc *sc)
{
int to;
- u_int32_t src;
+ u_int32_t src = 0;
for (to = 0; to < EAP_READ_TIMEOUT; to++) {
src = EREAD4(sc, E1371_SRC);
@@ -431,11 +431,14 @@ eap1371_src_read(struct eap_softc *sc, int a)
int to;
u_int32_t src, t;
- src = eap1371_src_wait(sc) & E1371_SRC_CTLMASK;
- src |= E1371_SRC_ADDR(a);
+ t = eap1371_src_wait(sc);
+
+ src = (t & E1371_SRC_CTLMASK) | E1371_SRC_ADDR(a);
EWRITE4(sc, E1371_SRC, src | E1371_SRC_STATE_OK);
- if ((eap1371_src_wait(sc) & E1371_SRC_STATE_MASK) != E1371_SRC_STATE_OK) {
+ t = eap1371_src_wait(sc);
+
+ if ((t & E1371_SRC_STATE_MASK) != E1371_SRC_STATE_OK) {
for (to = 0; to < EAP_READ_TIMEOUT; to++) {
t = EREAD4(sc, E1371_SRC);
if ((t & E1371_SRC_STATE_MASK) == E1371_SRC_STATE_OK)