From d6ba1862433688cd29c63e7885119a940d0960e7 Mon Sep 17 00:00:00 2001 From: rtr Date: Sun, 19 Mar 2006 06:22:45 +0000 Subject: [PATCH] avoid deref of NULL coverity 2436 / run 6 --- sys/dev/ic/iha.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/sys/dev/ic/iha.c b/sys/dev/ic/iha.c index 2ac8ffae3d36..f0cf7b50f2ff 100644 --- a/sys/dev/ic/iha.c +++ b/sys/dev/ic/iha.c @@ -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. @@ -39,7 +39,7 @@ */ #include -__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 #include @@ -1335,20 +1335,21 @@ iha_timeout(void *arg) { struct iha_scb *scb = (struct iha_scb *)arg; struct scsipi_xfer *xs = scb->xs; - struct scsipi_periph *periph = xs->xs_periph; + struct scsipi_periph *periph; 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; - if (xs == NULL) - printf("[debug] iha_timeout called with xs == NULL\n"); - - else { - scsipi_printaddr(periph); - printf("SCSI OpCode 0x%02x timed out\n", xs->cmd->opcode); - - iha_abort_xs(sc, xs, HOST_TIMED_OUT); - } + scsipi_printaddr(periph); + printf("SCSI OpCode 0x%02x timed out\n", xs->cmd->opcode); + iha_abort_xs(sc, xs, HOST_TIMED_OUT); } /*