Coverity CID 1320: Don't try to use drq16 as an index in an array if it is -1

This commit is contained in:
christos 2006-04-13 03:45:44 +00:00
parent 3c0717249d
commit dd8ade94a0

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbdsp.c,v 1.120 2006/03/29 04:16:50 thorpej Exp $ */ /* $NetBSD: sbdsp.c,v 1.121 2006/04/13 03:45:44 christos Exp $ */
/*- /*-
* Copyright (c) 1999 The NetBSD Foundation, Inc. * Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -81,7 +81,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.120 2006/03/29 04:16:50 thorpej Exp $"); __KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.121 2006/04/13 03:45:44 christos Exp $");
#include "midi.h" #include "midi.h"
#include "mpu.h" #include "mpu.h"
@ -344,8 +344,9 @@ sbdsp_jazz16_probe(struct sbdsp_softc *sc)
/* XXX set both 8 & 16-bit drq to same channel, it works fine. */ /* XXX set both 8 & 16-bit drq to same channel, it works fine. */
sc->sc_drq16 = sc->sc_drq8; sc->sc_drq16 = sc->sc_drq8;
if (sbdsp_wdsp(sc, JAZZ16_SET_DMAINTR) || if (sbdsp_wdsp(sc, JAZZ16_SET_DMAINTR) ||
(sc->sc_drq16 >= 0 &&
sbdsp_wdsp(sc, (jazz16_drq_conf[sc->sc_drq16] << 4) | sbdsp_wdsp(sc, (jazz16_drq_conf[sc->sc_drq16] << 4) |
jazz16_drq_conf[sc->sc_drq8]) || jazz16_drq_conf[sc->sc_drq8])) ||
sbdsp_wdsp(sc, jazz16_irq_conf[sc->sc_irq])) { sbdsp_wdsp(sc, jazz16_irq_conf[sc->sc_irq])) {
DPRINTF(("sbdsp: can't write jazz16 probe stuff\n")); DPRINTF(("sbdsp: can't write jazz16 probe stuff\n"));
} else { } else {