From bb41b0340a6e9caff24b2a76825f21ed89e01dcb Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Sat, 4 Feb 2012 17:52:23 +0000 Subject: Since sili_get_ccb() can return NULL if there are no ccb's available, check for the result in sili_pmp_softreset() as is done for all other invocations of sili_get_ccb(). While here disambiguate the printf's being emitted when sili_get_ccb() returns NULL. --- sys/dev/ic/sili.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'sys') diff --git a/sys/dev/ic/sili.c b/sys/dev/ic/sili.c index 33d279d3fdb..9fe184e0edf 100644 --- a/sys/dev/ic/sili.c +++ b/sys/dev/ic/sili.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sili.c,v 1.49 2011/07/04 04:44:50 dhill Exp $ */ +/* $OpenBSD: sili.c,v 1.50 2012/02/04 17:52:22 krw Exp $ */ /* * Copyright (c) 2007 David Gwynne @@ -868,7 +868,8 @@ sili_get_ccb(struct sili_port *sp) { struct sili_ccb *ccb; - /* don't allow new commands to start while doing PMP error + /* + * Don't allow new commands to start while doing PMP error * recovery */ if (sp->sp_pmp_error_recovery != 0) { @@ -1204,6 +1205,11 @@ sili_pmp_softreset(struct sili_softc *sc, int port, int pmp_port) sp = &sc->sc_ports[port]; ccb = sili_get_ccb(sp); + if (ccb == NULL) { + printf("%s: sili_pmp_softreset NULL ccb!\n", PORTNAME(sp)); + return (-1); + } + ccb->ccb_xa.flags = ATA_F_POLL | ATA_F_GET_RFIS; ccb->ccb_xa.complete = sili_dummy_done; ccb->ccb_xa.pmp_port = pmp_port; @@ -1734,6 +1740,7 @@ sili_ata_get_xfer(void *xsc, int port) ccb = sili_get_ccb(sp); if (ccb == NULL) { + printf("%s: sili_ata_get_xfer NULL ccb!\n", PORTNAME(sp)); return (NULL); } @@ -1761,7 +1768,7 @@ sili_pmp_read(struct sili_port *sp, int target, int which, u_int32_t *datap) ccb = sili_get_ccb(sp); if (ccb == NULL) { - printf("%s: NULL ccb!\n", PORTNAME(sp)); + printf("%s: sili_pmp_read NULL ccb!\n", PORTNAME(sp)); return (1); } ccb->ccb_xa.flags = ATA_F_POLL | ATA_F_GET_RFIS; @@ -1803,7 +1810,7 @@ sili_pmp_write(struct sili_port *sp, int target, int which, u_int32_t data) ccb = sili_get_ccb(sp); if (ccb == NULL) { - printf("%s: NULL ccb!\n", PORTNAME(sp)); + printf("%s: sili_pmp_write NULL ccb!\n", PORTNAME(sp)); return (1); } ccb->ccb_xa.complete = sili_dummy_done; -- cgit v1.2.3