- avoid possible NULL pointer dereference in error path

- call Debugger() only #ifdef OSIOP_DEBUG
Partially from OpenBSD.
This commit is contained in:
tsutsui 2007-06-30 19:35:08 +00:00
parent 25f9eea68b
commit 8dedfc4041

View File

@ -1,4 +1,4 @@
/* $NetBSD: osiop.c,v 1.31 2007/06/30 19:24:30 tsutsui Exp $ */
/* $NetBSD: osiop.c,v 1.32 2007/06/30 19:35:08 tsutsui Exp $ */
/*
* Copyright (c) 2001 Izumi Tsutsui. All rights reserved.
@ -100,7 +100,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osiop.c,v 1.31 2007/06/30 19:24:30 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: osiop.c,v 1.32 2007/06/30 19:35:08 tsutsui Exp $");
/* #define OSIOP_DEBUG */
@ -1645,7 +1645,7 @@ osiop_checkintr(struct osiop_softc *sc, uint8_t istat, uint8_t dstat,
*/
printf("osiop_chkintr: target %x ds %p\n", target, ds);
printf("scripts %lx ds %lx dsp %x dcmd %x\n", scraddr,
sc->sc_dsdma->dm_segs[0].ds_addr + acb->dsoffset,
acb ? sc->sc_dsdma->dm_segs[0].ds_addr + acb->dsoffset : 0,
osiop_read_4(sc, OSIOP_DSP),
osiop_read_4(sc, OSIOP_DBC));
printf("osiop_chkintr: istat %x dstat %x sstat0 %x "
@ -1653,18 +1653,21 @@ osiop_checkintr(struct osiop_softc *sc, uint8_t istat, uint8_t dstat,
istat, dstat, sstat0, intcode,
osiop_read_4(sc, OSIOP_DSA),
osiop_read_1(sc, OSIOP_SBCL),
ds->stat[0], ds->msgbuf[0], ds->msgbuf[1],
ds ? ds->stat[0] : 0,
ds ? ds->msgbuf[0] : 0,
ds ? ds->msgbuf[1] : 0,
osiop_read_1(sc, OSIOP_SFBR));
#ifdef OSIOP_DEBUG
if (osiop_debug & DEBUG_DMA)
panic("osiop_chkintr: **** temp ****");
#endif
#ifdef DDB
Debugger();
#endif
#endif
osiop_reset(sc); /* hard reset */
*status = SCSI_OSIOP_NOSTATUS;
acb->status = ACB_S_DONE;
if (acb != NULL)
acb->status = ACB_S_DONE;
return (0); /* osiop_reset cleaned up */
}