diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2005-11-03 04:05:58 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2005-11-03 04:05:58 +0000 |
commit | 02f5551e85767ee1238af7d45ae50366d8525e26 (patch) | |
tree | 234e30d5019494bb629070bdb485b9b982a4cb32 | |
parent | f24005cb0dff98bdcd290e01c6dc426255865870 (diff) |
Don't remove elements inside TAILQ_FOREACH. Change to usual for()
idiom.
-rw-r--r-- | sys/dev/ic/trm.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/ic/trm.c b/sys/dev/ic/trm.c index 022cd5f9095..a3b0479e513 100644 --- a/sys/dev/ic/trm.c +++ b/sys/dev/ic/trm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trm.c,v 1.4 2004/01/14 20:50:49 miod Exp $ +/* $OpenBSD: trm.c,v 1.5 2005/11/03 04:05:57 krw Exp $ * ------------------------------------------------------------ * O.S : OpenBSD * File Name : trm.c @@ -294,7 +294,7 @@ trm_RewaitSRB(struct trm_softc *sc, struct trm_scsi_req_q *pSRB) void trm_StartWaitingSRB(struct trm_softc *sc) { - struct trm_scsi_req_q *pSRB; + struct trm_scsi_req_q *pSRB, *next; int intflag; intflag = splbio(); @@ -304,7 +304,8 @@ trm_StartWaitingSRB(struct trm_softc *sc) (sc->sc_Flag & (RESET_DETECT | RESET_DONE | RESET_DEV)) != 0) return; - TAILQ_FOREACH(pSRB, &sc->waitingSRB, link) { + for (pSRB = TAILQ_FIRST(&sc->waitingSRB); pSRB != NULL; pSRB = next) { + next = TAILQ_NEXT(pSRB, link); if (trm_StartSRB(sc, pSRB) == 0) { pSRB->SRBFlag &= ~TRM_ON_WAITING_SRB; TAILQ_REMOVE(&sc->waitingSRB, pSRB, link); |