From 31535ad1301df759879d255f0c295017d926433c Mon Sep 17 00:00:00 2001 From: christos Date: Fri, 14 Apr 2006 20:16:02 +0000 Subject: [PATCH] Coverity CID 1081: Avoid NULL deref. --- sys/dev/i2o/iop.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/dev/i2o/iop.c b/sys/dev/i2o/iop.c index bed21e7b04fe..77349145907e 100644 --- a/sys/dev/i2o/iop.c +++ b/sys/dev/i2o/iop.c @@ -1,4 +1,4 @@ -/* $NetBSD: iop.c,v 1.54 2006/03/29 06:45:05 thorpej Exp $ */ +/* $NetBSD: iop.c,v 1.55 2006/04/14 20:16:02 christos Exp $ */ /*- * Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.54 2006/03/29 06:45:05 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.55 2006/04/14 20:16:02 christos Exp $"); #include "opt_i2o.h" #include "iop.h" @@ -1772,15 +1772,18 @@ iop_handle_reply(struct iop_softc *sc, u_int32_t rmfa) /* Notify the initiator. */ if ((im->im_flags & IM_WAIT) != 0) wakeup(im); - else if ((im->im_flags & (IM_POLL | IM_POLL_INTR)) != IM_POLL) - (*ii->ii_intr)(ii->ii_dv, im, rb); + else if ((im->im_flags & (IM_POLL | IM_POLL_INTR)) != IM_POLL) { + if (ii) + (*ii->ii_intr)(ii->ii_dv, im, rb); + } } else { /* * This initiator discards message wrappers. * * Simply pass the reply frame to the initiator. */ - (*ii->ii_intr)(ii->ii_dv, NULL, rb); + if (ii) + (*ii->ii_intr)(ii->ii_dv, NULL, rb); } return (status);