diff --git a/sys/dev/ieee1394/fwdma.c b/sys/dev/ieee1394/fwdma.c index 8b7fc0de29e7..3f721de7af00 100644 --- a/sys/dev/ieee1394/fwdma.c +++ b/sys/dev/ieee1394/fwdma.c @@ -1,4 +1,4 @@ -/* $NetBSD: fwdma.c,v 1.4 2006/04/30 14:14:06 kiyohara Exp $ */ +/* $NetBSD: fwdma.c,v 1.5 2006/04/30 14:18:41 kiyohara Exp $ */ /*- * Copyright (c) 2003 * Hidetoshi Shimokawa. All rights reserved. @@ -186,7 +186,7 @@ fwdma_malloc_multiseg(struct firewire_comm *fc, int alignment, struct fwdma_alloc_multi *am; struct fwdma_seg *seg; bus_size_t ssize; - int nseg; + int nseg, size; if (esize > PAGE_SIZE) { /* round up to PAGE_SIZE */ @@ -197,12 +197,14 @@ fwdma_malloc_multiseg(struct firewire_comm *fc, int alignment, ssize = rounddown(PAGE_SIZE, esize); nseg = howmany(n, ssize / esize); } - am = (struct fwdma_alloc_multi *)malloc(sizeof(struct fwdma_alloc_multi) - + sizeof(struct fwdma_seg)*nseg, M_FW, M_WAITOK); + size = sizeof (struct fwdma_alloc_multi) + + sizeof (struct fwdma_seg) * nseg; + am = (struct fwdma_alloc_multi *)malloc(size, M_FW, M_WAITOK); if (am == NULL) { printf("fwdma_malloc_multiseg: malloc failed\n"); return(NULL); } + memset(am, 0, size); am->ssize = ssize; am->esize = esize; am->nseg = 0; diff --git a/sys/dev/ieee1394/fwohci.c b/sys/dev/ieee1394/fwohci.c index 1769f6b2ac0d..4533ba871245 100644 --- a/sys/dev/ieee1394/fwohci.c +++ b/sys/dev/ieee1394/fwohci.c @@ -1,4 +1,4 @@ -/* $NetBSD: fwohci.c,v 1.97 2006/04/30 14:14:06 kiyohara Exp $ */ +/* $NetBSD: fwohci.c,v 1.98 2006/04/30 14:18:40 kiyohara Exp $ */ /*- * Copyright (c) 2003 Hidetoshi Shimokawa @@ -58,7 +58,7 @@ #include #include -__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.97 2006/04/30 14:14:06 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.98 2006/04/30 14:18:40 kiyohara Exp $"); #if defined(__DragonFly__) || __FreeBSD_version < 500000 #include /* for DELAY() */ @@ -2704,7 +2704,7 @@ fwohci_add_rx_buf(struct fwohci_dbch *dbch, struct fwohcidb_tr *db_tr, int dsiz[2]; ir = &dbch->xferq; - if (ir->buf == NULL && (dbch->xferq.flag & FWXFERQ_EXTBUF) == 0) { + if (db_tr->buf == NULL && (dbch->xferq.flag & FWXFERQ_EXTBUF) == 0) { db_tr->buf = fwdma_malloc_size(dbch->dmat, &db_tr->dma_map, ir->psize, &dbuf[0], BUS_DMA_NOWAIT); if (db_tr->buf == NULL) @@ -2720,7 +2720,7 @@ fwohci_add_rx_buf(struct fwohci_dbch *dbch, struct fwohcidb_tr *db_tr, dbuf[db_tr->dbcnt++] = dummy_dma->bus_addr; } dsiz[db_tr->dbcnt] = ir->psize; - if (ir->buf != NULL) { + if (db_tr->buf != NULL) { db_tr->buf = fwdma_v_addr(ir->buf, poffset); dbuf[db_tr->dbcnt] = fwdma_bus_addr( ir->buf, poffset); }