From 02f5551e85767ee1238af7d45ae50366d8525e26 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Thu, 3 Nov 2005 04:05:58 +0000 Subject: Don't remove elements inside TAILQ_FOREACH. Change to usual for() idiom. --- sys/dev/ic/trm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/dev/ic/trm.c') 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); -- cgit v1.2.3