Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ieee1394 Call malloc(M_ZERO) instead of malloc() and...



details:   https://anonhg.NetBSD.org/src/rev/e294ffea063e
branches:  trunk
changeset: 754379:e294ffea063e
user:      kiyohara <kiyohara%NetBSD.org@localhost>
date:      Thu Apr 29 06:56:00 2010 +0000

description:
Call malloc(M_ZERO) instead of malloc() and memset().

diffstat:

 sys/dev/ieee1394/fwdma.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (42 lines):

diff -r f6d976571e57 -r e294ffea063e sys/dev/ieee1394/fwdma.c
--- a/sys/dev/ieee1394/fwdma.c  Thu Apr 29 06:54:26 2010 +0000
+++ b/sys/dev/ieee1394/fwdma.c  Thu Apr 29 06:56:00 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fwdma.c,v 1.13 2010/03/29 03:05:27 kiyohara Exp $      */
+/*     $NetBSD: fwdma.c,v 1.14 2010/04/29 06:56:00 kiyohara Exp $      */
 /*-
  * Copyright (c) 2003
  *     Hidetoshi Shimokawa. All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fwdma.c,v 1.13 2010/03/29 03:05:27 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwdma.c,v 1.14 2010/04/29 06:56:00 kiyohara Exp $");
 #if defined(__FreeBSD__)
 __FBSDID("$FreeBSD: src/sys/dev/firewire/fwdma.c,v 1.9 2007/06/06 14:31:36 simokawa Exp $");
 #endif
@@ -141,7 +141,8 @@
        struct fwdma_alloc_multi *am;
        struct fwdma_seg *seg;
        bus_size_t ssize;
-       int nseg, size;
+       size_t size;
+       int nseg;
 
        if (esize > PAGE_SIZE) {
                /* round up to PAGE_SIZE */
@@ -154,12 +155,11 @@
        }
        size = sizeof(struct fwdma_alloc_multi) +
            sizeof(struct fwdma_seg) * nseg;
-       am = (struct fwdma_alloc_multi *)malloc(size, M_FW, M_WAITOK);
+       am = (struct fwdma_alloc_multi *)malloc(size, M_FW, M_WAITOK | M_ZERO);
        if (am == NULL) {
                aprint_error_dev(fc->dev, "malloc failed\n");
                return NULL;
        }
-       memset(am, 0, size);
        am->ssize = ssize;
        am->esize = esize;
        am->nseg = 0;



Home | Main Index | Thread Index | Old Index