avoid deref of NULL

coverity 2436 / run 6
This commit is contained in:
rtr 2006-03-19 06:22:45 +00:00
parent 2e1bb9e9d2
commit d6ba186243
1 changed files with 13 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: iha.c,v 1.31 2005/12/24 20:27:30 perry Exp $ */ /* $NetBSD: iha.c,v 1.32 2006/03/19 06:22:45 rtr Exp $ */
/*- /*-
* Device driver for the INI-9XXXU/UW or INIC-940/950 PCI SCSI Controller. * Device driver for the INI-9XXXU/UW or INIC-940/950 PCI SCSI Controller.
@ -39,7 +39,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: iha.c,v 1.31 2005/12/24 20:27:30 perry Exp $"); __KERNEL_RCSID(0, "$NetBSD: iha.c,v 1.32 2006/03/19 06:22:45 rtr Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -1335,20 +1335,21 @@ iha_timeout(void *arg)
{ {
struct iha_scb *scb = (struct iha_scb *)arg; struct iha_scb *scb = (struct iha_scb *)arg;
struct scsipi_xfer *xs = scb->xs; struct scsipi_xfer *xs = scb->xs;
struct scsipi_periph *periph = xs->xs_periph; struct scsipi_periph *periph;
struct iha_softc *sc; struct iha_softc *sc;
if (xs == NULL) {
printf("[debug] iha_timeout called with xs == NULL\n");
return;
}
periph = xs->xs_periph;
sc = (void *)periph->periph_channel->chan_adapter->adapt_dev; sc = (void *)periph->periph_channel->chan_adapter->adapt_dev;
if (xs == NULL) scsipi_printaddr(periph);
printf("[debug] iha_timeout called with xs == NULL\n"); printf("SCSI OpCode 0x%02x timed out\n", xs->cmd->opcode);
iha_abort_xs(sc, xs, HOST_TIMED_OUT);
else {
scsipi_printaddr(periph);
printf("SCSI OpCode 0x%02x timed out\n", xs->cmd->opcode);
iha_abort_xs(sc, xs, HOST_TIMED_OUT);
}
} }
/* /*