summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreivind <eivind@FreeBSD.org>1998-12-22 00:52:27 +0000
committereivind <eivind@FreeBSD.org>1998-12-22 00:52:27 +0000
commit026c874b6d230f885e16822e5bd586fb239d5a22 (patch)
treef6b8e40d36822555a5ef46f4380430c4ec113ef7
parenta4213663c9a0665ca27785031ebf9716429b3061 (diff)
downloadFreeBSD-src-026c874b6d230f885e16822e5bd586fb239d5a22.zip
FreeBSD-src-026c874b6d230f885e16822e5bd586fb239d5a22.tar.gz
Better error checking and more complete struct initialization.
Reviewed by: Simon Shapiro <shimon@simon-shapiro.org>
-rw-r--r--sys/dev/dpt/dpt_scsi.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sys/dev/dpt/dpt_scsi.c b/sys/dev/dpt/dpt_scsi.c
index 42ff038..1f7e6c6 100644
--- a/sys/dev/dpt/dpt_scsi.c
+++ b/sys/dev/dpt/dpt_scsi.c
@@ -43,7 +43,7 @@
* arrays that span controllers (Wow!).
*/
-#ident "$Id: dpt_scsi.c,v 1.19 1998/10/15 23:17:56 gibbs Exp $"
+#ident "$Id: dpt_scsi.c,v 1.20 1998/10/15 23:46:24 gibbs Exp $"
#define _DPT_C_
@@ -300,10 +300,15 @@ dptallocsgmap(struct dpt_softc *dpt)
return (NULL);
}
- SLIST_INSERT_HEAD(&dpt->sg_maps, sg_map, links);
+ if (bus_dmamap_load(dpt->sg_dmat, sg_map->sg_dmamap, sg_map->sg_vaddr,
+ PAGE_SIZE, dptmapmem, &sg_map->sg_physaddr, /*flags*/0)) {
+ bus_dmamem_free(dpt->sg_dmat, sg_map->sg_vaddr,
+ sg_map->sg_dmamap);
+ free(sg_map, M_DEVBUF);
+ return (NULL);
+ }
- bus_dmamap_load(dpt->sg_dmat, sg_map->sg_dmamap, sg_map->sg_vaddr,
- PAGE_SIZE, dptmapmem, &sg_map->sg_physaddr, /*flags*/0);
+ SLIST_INSERT_HEAD(&dpt->sg_maps, sg_map, links);
return (sg_map);
}
@@ -1128,7 +1133,7 @@ dpt_free(struct dpt_softc *dpt)
free(dpt, M_DEVBUF);
}
-u_int8_t string_sizes[] =
+static u_int8_t string_sizes[] =
{
sizeof(((dpt_inq_t*)NULL)->vendor),
sizeof(((dpt_inq_t*)NULL)->modelNum),
@@ -1147,6 +1152,9 @@ dpt_init(struct dpt_softc *dpt)
int i;
int retval;
+ dpt->init_level = 0;
+ SLIST_INIT(&dpt->sg_maps);
+
#ifdef DPT_RESET_BOARD
printf("dpt%d: resetting HBA\n", dpt->unit);
dpt_outb(dpt, HA_WCOMMAND, EATA_CMD_RESET);
OpenPOWER on IntegriCloud