summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2007-10-06 23:50:56 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2007-10-06 23:50:56 +0000
commitf5461d41b129fefc48ff4c9ded82554394de9bf0 (patch)
tree86f9d97cdbd7712121debe572c568e72070e2559 /sys/dev/pci
parentfd70724e0c6df0ffd868e0c7d80b8f683072b49a (diff)
Simpliest memset(,0,) -> M_ZERO changes. One (caddr *) cast removal,
otherwise just adding M_ZERO to malloc() and removing the immediately adjacent memset(,0,).
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/agp_amd.c5
-rw-r--r--sys/dev/pci/agp_i810.c5
-rw-r--r--sys/dev/pci/agp_intel.c5
-rw-r--r--sys/dev/pci/agp_via.c5
-rw-r--r--sys/dev/pci/cz.c6
5 files changed, 10 insertions, 16 deletions
diff --git a/sys/dev/pci/agp_amd.c b/sys/dev/pci/agp_amd.c
index 7766ba8b5b2..d09027a3183 100644
--- a/sys/dev/pci/agp_amd.c
+++ b/sys/dev/pci/agp_amd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp_amd.c,v 1.3 2007/08/04 19:40:25 reyk Exp $ */
+/* $OpenBSD: agp_amd.c,v 1.4 2007/10/06 23:50:54 krw Exp $ */
/* $NetBSD: agp_amd.c,v 1.6 2001/10/06 02:48:50 thorpej Exp $ */
@@ -162,13 +162,12 @@ agp_amd_attach(struct vga_pci_softc *sc, struct pci_attach_args *pa, struct pci_
pcireg_t reg;
int error;
- asc = malloc(sizeof *asc, M_DEVBUF, M_NOWAIT);
+ asc = malloc(sizeof *asc, M_DEVBUF, M_NOWAIT | M_ZERO);
if (asc == NULL) {
printf(": can't allocate softc\n");
/* agp_generic_detach(sc) */
return (ENOMEM);
}
- memset(asc, 0, sizeof *asc);
error = pci_mapreg_map(pchb_pa, AGP_AMD751_REGISTERS,
PCI_MAPREG_TYPE_MEM,0, &asc->iot, &asc->ioh, NULL, NULL, 0);
diff --git a/sys/dev/pci/agp_i810.c b/sys/dev/pci/agp_i810.c
index d405e3d4e89..4af86c1db1d 100644
--- a/sys/dev/pci/agp_i810.c
+++ b/sys/dev/pci/agp_i810.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp_i810.c,v 1.16 2007/09/17 01:33:33 krw Exp $ */
+/* $OpenBSD: agp_i810.c,v 1.17 2007/10/06 23:50:54 krw Exp $ */
/* $NetBSD: agp_i810.c,v 1.15 2003/01/31 00:07:39 thorpej Exp $ */
/*-
@@ -116,12 +116,11 @@ agp_i810_attach(struct vga_pci_softc *sc, struct pci_attach_args *pa,
int error;
u_int memtype = 0;
- isc = malloc(sizeof *isc, M_DEVBUF, M_NOWAIT);
+ isc = malloc(sizeof *isc, M_DEVBUF, M_NOWAIT | M_ZERO);
if (isc == NULL) {
printf(": can't allocate chipset-specific softc\n");
return (ENOMEM);
}
- memset(isc, 0, sizeof *isc);
sc->sc_chipc = isc;
sc->sc_methods = &agp_i810_methods;
memcpy(&isc->bridge_pa, pchb_pa, sizeof *pchb_pa);
diff --git a/sys/dev/pci/agp_intel.c b/sys/dev/pci/agp_intel.c
index a1110fb9344..722b0f8f982 100644
--- a/sys/dev/pci/agp_intel.c
+++ b/sys/dev/pci/agp_intel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp_intel.c,v 1.4 2007/08/04 19:40:25 reyk Exp $ */
+/* $OpenBSD: agp_intel.c,v 1.5 2007/10/06 23:50:54 krw Exp $ */
/* $NetBSD: agp_intel.c,v 1.3 2001/09/15 00:25:00 thorpej Exp $ */
/*-
@@ -82,12 +82,11 @@ agp_intel_attach(struct vga_pci_softc *sc, struct pci_attach_args *pa,
struct agp_gatt *gatt;
pcireg_t reg;
- isc = malloc(sizeof *isc, M_DEVBUF, M_NOWAIT);
+ isc = malloc(sizeof *isc, M_DEVBUF, M_NOWAIT | M_ZERO);
if (isc == NULL) {
printf(": can't allocate chipset-specific softc\n");
return (ENOMEM);
}
- memset(isc, 0, sizeof *isc);
sc->sc_methods = &agp_intel_methods;
sc->sc_chipc = isc;
diff --git a/sys/dev/pci/agp_via.c b/sys/dev/pci/agp_via.c
index ddee7cf101f..bb9c0114699 100644
--- a/sys/dev/pci/agp_via.c
+++ b/sys/dev/pci/agp_via.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp_via.c,v 1.3 2007/08/04 19:40:25 reyk Exp $ */
+/* $OpenBSD: agp_via.c,v 1.4 2007/10/06 23:50:54 krw Exp $ */
/* $NetBSD: agp_via.c,v 1.2 2001/09/15 00:25:00 thorpej Exp $ */
/*-
@@ -80,12 +80,11 @@ agp_via_attach(struct vga_pci_softc *sc, struct pci_attach_args *pa,
struct agp_via_softc *asc;
struct agp_gatt *gatt;
- asc = malloc(sizeof *asc, M_DEVBUF, M_NOWAIT);
+ asc = malloc(sizeof *asc, M_DEVBUF, M_NOWAIT | M_ZERO);
if (asc == NULL) {
printf(": can't allocate chipset-specific softc\n");
return (ENOMEM);
}
- memset(asc, 0, sizeof *asc);
sc->sc_chipc = asc;
sc->sc_methods = &agp_via_methods;
diff --git a/sys/dev/pci/cz.c b/sys/dev/pci/cz.c
index 3b3929a1cc3..2776c396f31 100644
--- a/sys/dev/pci/cz.c
+++ b/sys/dev/pci/cz.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cz.c,v 1.9 2003/10/03 16:44:51 miod Exp $ */
+/* $OpenBSD: cz.c,v 1.10 2007/10/06 23:50:54 krw Exp $ */
/* $NetBSD: cz.c,v 1.15 2001/01/20 19:10:36 thorpej Exp $ */
/*-
@@ -389,10 +389,8 @@ cz_attach(parent, self, aux)
}
cz->cz_ports = malloc(sizeof(struct cztty_softc) * cz->cz_nchannels,
- M_DEVBUF, M_WAITOK);
+ M_DEVBUF, M_WAITOK | M_ZERO);
cztty_attached_ttys += cz->cz_nchannels;
- memset(cz->cz_ports, 0,
- sizeof(struct cztty_softc) * cz->cz_nchannels);
for (i = 0; i < cz->cz_nchannels; i++) {
sc = &cz->cz_ports[i];