summaryrefslogtreecommitdiff
path: root/sys/dev/pci/ahci.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2007-10-01 15:34:49 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2007-10-01 15:34:49 +0000
commita730dedabc875f93e81898068b1cccdb9e45cb7c (patch)
tree059cc27503e1389b0da52a36e3fd0e692e1f24e2 /sys/dev/pci/ahci.c
parentd75aaeaf6b0231dbe849cd06ddac7f63b1e30bcc (diff)
More easy bzero() -> M_ZERO. Use 'p = malloc(sizeof(*p) ...' where
obvious.
Diffstat (limited to 'sys/dev/pci/ahci.c')
-rw-r--r--sys/dev/pci/ahci.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/dev/pci/ahci.c b/sys/dev/pci/ahci.c
index 2c0236e1287..51f36a94418 100644
--- a/sys/dev/pci/ahci.c
+++ b/sys/dev/pci/ahci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahci.c,v 1.128 2007/07/03 22:33:20 dlg Exp $ */
+/* $OpenBSD: ahci.c,v 1.129 2007/10/01 15:34:48 krw Exp $ */
/*
* Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -824,13 +824,12 @@ ahci_port_alloc(struct ahci_softc *sc, u_int port)
struct ahci_cmd_table *table;
int i, rc = ENOMEM;
- ap = malloc(sizeof(struct ahci_port), M_DEVBUF, M_NOWAIT);
+ ap = malloc(sizeof(*ap), M_DEVBUF, M_NOWAIT | M_ZERO);
if (ap == NULL) {
printf("%s: unable to allocate memory for port %d\n",
DEVNAME(sc), port);
goto reterr;
}
- bzero(ap, sizeof(struct ahci_port));
#ifdef AHCI_DEBUG
snprintf(ap->ap_name, sizeof(ap->ap_name), "%s.%d",
@@ -899,13 +898,12 @@ ahci_port_alloc(struct ahci_softc *sc, u_int port)
/* Allocate a CCB for each command slot */
ap->ap_ccbs = malloc(sizeof(struct ahci_ccb) * sc->sc_ncmds, M_DEVBUF,
- M_NOWAIT);
+ M_NOWAIT | M_ZERO);
if (ap->ap_ccbs == NULL) {
printf("%s: unable to allocate command list for port %d\n",
DEVNAME(sc), port);
goto freeport;
}
- bzero(ap->ap_ccbs, sizeof(struct ahci_ccb) * sc->sc_ncmds);
/* Command List Structures and Command Tables */
ap->ap_dmamem_cmd_list = ahci_dmamem_alloc(sc,
@@ -2030,11 +2028,10 @@ ahci_dmamem_alloc(struct ahci_softc *sc, size_t size)
struct ahci_dmamem *adm;
int nsegs;
- adm = malloc(sizeof(struct ahci_dmamem), M_DEVBUF, M_NOWAIT);
+ adm = malloc(sizeof(*adm), M_DEVBUF, M_NOWAIT | M_ZERO);
if (adm == NULL)
return (NULL);
- bzero(adm, sizeof(struct ahci_dmamem));
adm->adm_size = size;
if (bus_dmamap_create(sc->sc_dmat, size, 1, size, 0,