Correct check for NULL pointer references in siop_scsidone().

Only call Debugger() if DDB is defined.
If the wait for reselect is interrupted and sc_nexus was NULL, only
print the debug message if DEBUG is defined.
This commit is contained in:
mhitch 1996-04-28 06:28:24 +00:00
parent 7327b8ff44
commit 0fa2771b31
1 changed files with 12 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: siop.c,v 1.31 1996/04/23 22:53:31 veego Exp $ */ /* $NetBSD: siop.c,v 1.32 1996/04/28 06:28:24 mhitch Exp $ */
/* /*
* Copyright (c) 1994 Michael L. Hitch * Copyright (c) 1994 Michael L. Hitch
@ -359,19 +359,20 @@ siop_scsidone(acb, stat)
struct siop_acb *acb; struct siop_acb *acb;
int stat; int stat;
{ {
struct scsi_xfer *xs = acb->xs; struct scsi_xfer *xs;
struct scsi_link *slp; struct scsi_link *slp;
struct siop_softc *sc; struct siop_softc *sc;
int dosched = 0; int dosched = 0;
if (acb == NULL || (xs = acb->xs) == NULL) {
#ifdef DIAGNOSTIC #ifdef DIAGNOSTIC
if (acb == NULL || xs == NULL) { printf("siop_scsidone: NULL acb or scsi_xfer\n");
/* panic("siop_scsidone"); */ #if defined(DEBUG) && defined(DDB)
printf("siop_scsidone: sc_nexus NULL\n");
Debugger(); Debugger();
#endif
#endif
return; return;
} }
#endif
slp = xs->sc_link; slp = xs->sc_link;
sc = slp->adapter_softc; sc = slp->adapter_softc;
/* /*
@ -904,7 +905,9 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
sc->sc_scriptspa + sizeof(scripts)); sc->sc_scriptspa + sizeof(scripts));
printf(" istat %x dstat %x sstat0 %x\n", printf(" istat %x dstat %x sstat0 %x\n",
istat, dstat, sstat0); istat, dstat, sstat0);
#ifdef DDB
Debugger(); Debugger();
#endif
} }
#endif #endif
SIOP_TRACE('i',dstat,istat,(istat&SIOP_ISTAT_DIP)?rp->siop_dsps&0xff:sstat0); SIOP_TRACE('i',dstat,istat,(istat&SIOP_ISTAT_DIP)?rp->siop_dsps&0xff:sstat0);
@ -1027,7 +1030,7 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
if ((rp->siop_sbcl & SIOP_REQ) == 0) { if ((rp->siop_sbcl & SIOP_REQ) == 0) {
printf ("Phase mismatch: REQ not asserted! %02x dsp %lx\n", printf ("Phase mismatch: REQ not asserted! %02x dsp %lx\n",
rp->siop_sbcl, rp->siop_dsp); rp->siop_sbcl, rp->siop_dsp);
#ifdef DEBUG #if defined(DEBUG) && defined(DDB)
Debugger(); Debugger();
#endif #endif
} }
@ -1290,6 +1293,7 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
#endif #endif
/* XXX assumes it was not select */ /* XXX assumes it was not select */
if (sc->sc_nexus == NULL) { if (sc->sc_nexus == NULL) {
#ifdef DEBUG
printf("%s: reselect interrupted, sc_nexus == NULL\n", printf("%s: reselect interrupted, sc_nexus == NULL\n",
sc->sc_dev.dv_xname); sc->sc_dev.dv_xname);
#if 0 #if 0
@ -1297,6 +1301,7 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
#ifdef DDB #ifdef DDB
Debugger(); Debugger();
#endif #endif
#endif
#endif #endif
rp->siop_dcntl |= SIOP_DCNTL_STD; rp->siop_dcntl |= SIOP_DCNTL_STD;
return(0); return(0);