From 16db48d2fca6b72705cce71da960cd9563a953f3 Mon Sep 17 00:00:00 2001 From: krw Date: Mon, 3 Apr 2000 00:04:01 +0000 Subject: [PATCH] Bring code into line with comment and ensure that carr_freelist always has a carrier on it. This should fix a problem where carr_freelist has become NULL and then AdvISR() attempts to put a carrier back on the list without checking if carr_freelist is non-NULL. This and the previous two changes to adwlib.c and the change committed to adw.c at the same time were derived in whole or part from work done by/with dante@ from NetBSD. --- sys/dev/ic/adwlib.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/dev/ic/adwlib.c b/sys/dev/ic/adwlib.c index 4db6ad7b194..73cbea33402 100644 --- a/sys/dev/ic/adwlib.c +++ b/sys/dev/ic/adwlib.c @@ -1882,7 +1882,7 @@ ADW_SCSI_REQ_Q *scsiq; ADW_CCB *ccb; long req_size; u_int32_t req_paddr; - ADW_CARRIER *new_carrp/*, *ccb_carr; + ADW_CARRIER *new_carrp, *new_freep/*, *ccb_carr; int i*/; @@ -1902,11 +1902,14 @@ ADW_SCSI_REQ_Q *scsiq; * Allocate a carrier ensuring at least one carrier always * remains on the freelist and initialize fields. */ - if ((new_carrp = sc->carr_freelist) == NULL) { + new_carrp = sc->carr_freelist; + new_freep = adw_carrier_phys_kv( sc, + ASC_GET_CARRP( new_carrp->next_vpa) ); + + if (new_freep == NULL) { return ADW_BUSY; } - sc->carr_freelist = adw_carrier_phys_kv(sc, - ASC_GET_CARRP(new_carrp->next_vpa)); + sc->carr_freelist = new_freep; sc->carr_pending_cnt++; /* -- 2.20.1