summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2007-09-07 19:05:06 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2007-09-07 19:05:06 +0000
commitd129be97b55680517d1ece36497d0968d019655e (patch)
treeb488a982f0f7a0e0adc56f816efa6082c5d3d372
parent9dcfd606dedda51e51c48b2bd2f2fa322a947a6a (diff)
use new malloc M_ZERO flag to shrink kernel.
remove <malloc.h> from files where malloc is not used.
-rw-r--r--sys/dev/ic/rt2560.c16
-rw-r--r--sys/dev/ic/rt2661.c16
-rw-r--r--sys/dev/pci/if_ipw.c3
-rw-r--r--sys/dev/pci/if_iwi.c3
-rw-r--r--sys/dev/pci/if_iwn.c13
-rw-r--r--sys/dev/pci/if_nfe.c3
-rw-r--r--sys/dev/pci/if_wpi.c13
-rw-r--r--sys/dev/usb/if_ral.c3
-rw-r--r--sys/dev/usb/if_rum.c3
-rw-r--r--sys/dev/usb/if_uath.c3
-rw-r--r--sys/dev/usb/if_zyd.c9
-rw-r--r--sys/dev/usb/ueagle.c3
12 files changed, 25 insertions, 63 deletions
diff --git a/sys/dev/ic/rt2560.c b/sys/dev/ic/rt2560.c
index a9c73b084ae..109805bae1d 100644
--- a/sys/dev/ic/rt2560.c
+++ b/sys/dev/ic/rt2560.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rt2560.c,v 1.32 2007/03/08 21:58:27 deraadt Exp $ */
+/* $OpenBSD: rt2560.c,v 1.33 2007/09/07 19:05:05 damien Exp $ */
/*-
* Copyright (c) 2005, 2006
@@ -386,7 +386,7 @@ rt2560_alloc_tx_ring(struct rt2560_softc *sc, struct rt2560_tx_ring *ring,
ring->physaddr = ring->map->dm_segs->ds_addr;
ring->data = malloc(count * sizeof (struct rt2560_tx_data), M_DEVBUF,
- M_NOWAIT);
+ M_NOWAIT | M_ZERO);
if (ring->data == NULL) {
printf("%s: could not allocate soft data\n",
sc->sc_dev.dv_xname);
@@ -394,7 +394,6 @@ rt2560_alloc_tx_ring(struct rt2560_softc *sc, struct rt2560_tx_ring *ring,
goto fail;
}
- memset(ring->data, 0, count * sizeof (struct rt2560_tx_data));
for (i = 0; i < count; i++) {
error = bus_dmamap_create(sc->sc_dmat, MCLBYTES,
RT2560_MAX_SCATTER, MCLBYTES, 0, BUS_DMA_NOWAIT,
@@ -532,7 +531,7 @@ rt2560_alloc_rx_ring(struct rt2560_softc *sc, struct rt2560_rx_ring *ring,
ring->physaddr = ring->map->dm_segs->ds_addr;
ring->data = malloc(count * sizeof (struct rt2560_rx_data), M_DEVBUF,
- M_NOWAIT);
+ M_NOWAIT | M_ZERO);
if (ring->data == NULL) {
printf("%s: could not allocate soft data\n",
sc->sc_dev.dv_xname);
@@ -543,7 +542,6 @@ rt2560_alloc_rx_ring(struct rt2560_softc *sc, struct rt2560_rx_ring *ring,
/*
* Pre-allocate Rx buffers and populate Rx ring.
*/
- memset(ring->data, 0, count * sizeof (struct rt2560_rx_data));
for (i = 0; i < count; i++) {
struct rt2560_rx_desc *desc = &sc->rxq.desc[i];
struct rt2560_rx_data *data = &sc->rxq.data[i];
@@ -645,12 +643,8 @@ rt2560_free_rx_ring(struct rt2560_softc *sc, struct rt2560_rx_ring *ring)
struct ieee80211_node *
rt2560_node_alloc(struct ieee80211com *ic)
{
- struct rt2560_node *rn;
-
- rn = malloc(sizeof (struct rt2560_node), M_DEVBUF, M_NOWAIT);
- if (rn != NULL)
- bzero(rn, sizeof (struct rt2560_node));
- return (struct ieee80211_node *)rn;
+ return malloc(sizeof (struct rt2560_node), M_DEVBUF,
+ M_NOWAIT | M_ZERO);
}
int
diff --git a/sys/dev/ic/rt2661.c b/sys/dev/ic/rt2661.c
index 90b892c20d1..a9d7b101364 100644
--- a/sys/dev/ic/rt2661.c
+++ b/sys/dev/ic/rt2661.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rt2661.c,v 1.37 2007/08/28 18:34:38 deraadt Exp $ */
+/* $OpenBSD: rt2661.c,v 1.38 2007/09/07 19:05:05 damien Exp $ */
/*-
* Copyright (c) 2006
@@ -419,7 +419,7 @@ rt2661_alloc_tx_ring(struct rt2661_softc *sc, struct rt2661_tx_ring *ring,
ring->physaddr = ring->map->dm_segs->ds_addr;
ring->data = malloc(count * sizeof (struct rt2661_tx_data), M_DEVBUF,
- M_NOWAIT);
+ M_NOWAIT | M_ZERO);
if (ring->data == NULL) {
printf("%s: could not allocate soft data\n",
sc->sc_dev.dv_xname);
@@ -427,7 +427,6 @@ rt2661_alloc_tx_ring(struct rt2661_softc *sc, struct rt2661_tx_ring *ring,
goto fail;
}
- memset(ring->data, 0, count * sizeof (struct rt2661_tx_data));
for (i = 0; i < count; i++) {
error = bus_dmamap_create(sc->sc_dmat, MCLBYTES,
RT2661_MAX_SCATTER, MCLBYTES, 0, BUS_DMA_NOWAIT,
@@ -562,7 +561,7 @@ rt2661_alloc_rx_ring(struct rt2661_softc *sc, struct rt2661_rx_ring *ring,
ring->physaddr = ring->map->dm_segs->ds_addr;
ring->data = malloc(count * sizeof (struct rt2661_rx_data), M_DEVBUF,
- M_NOWAIT);
+ M_NOWAIT | M_ZERO);
if (ring->data == NULL) {
printf("%s: could not allocate soft data\n",
sc->sc_dev.dv_xname);
@@ -573,7 +572,6 @@ rt2661_alloc_rx_ring(struct rt2661_softc *sc, struct rt2661_rx_ring *ring,
/*
* Pre-allocate Rx buffers and populate Rx ring.
*/
- memset(ring->data, 0, count * sizeof (struct rt2661_rx_data));
for (i = 0; i < count; i++) {
struct rt2661_rx_desc *desc = &sc->rxq.desc[i];
struct rt2661_rx_data *data = &sc->rxq.data[i];
@@ -672,12 +670,8 @@ rt2661_free_rx_ring(struct rt2661_softc *sc, struct rt2661_rx_ring *ring)
struct ieee80211_node *
rt2661_node_alloc(struct ieee80211com *ic)
{
- struct rt2661_node *rn;
-
- rn = malloc(sizeof (struct rt2661_node), M_DEVBUF, M_NOWAIT);
- if (rn != NULL)
- bzero(rn, sizeof (struct rt2661_node));
- return (struct ieee80211_node *)rn;
+ return malloc(sizeof (struct rt2661_node), M_DEVBUF,
+ M_NOWAIT | M_ZERO);
}
int
diff --git a/sys/dev/pci/if_ipw.c b/sys/dev/pci/if_ipw.c
index 4c74546ddf1..1df56e0435f 100644
--- a/sys/dev/pci/if_ipw.c
+++ b/sys/dev/pci/if_ipw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ipw.c,v 1.68 2007/08/28 18:34:38 deraadt Exp $ */
+/* $OpenBSD: if_ipw.c,v 1.69 2007/09/07 19:05:05 damien Exp $ */
/*-
* Copyright (c) 2004-2006
@@ -40,7 +40,6 @@
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/systm.h>
-#include <sys/malloc.h>
#include <sys/conf.h>
#include <sys/device.h>
diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c
index 9fffd6ed341..3ff94e961e2 100644
--- a/sys/dev/pci/if_iwi.c
+++ b/sys/dev/pci/if_iwi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwi.c,v 1.84 2007/08/28 18:34:38 deraadt Exp $ */
+/* $OpenBSD: if_iwi.c,v 1.85 2007/09/07 19:05:05 damien Exp $ */
/*-
* Copyright (c) 2004-2006
@@ -40,7 +40,6 @@
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/systm.h>
-#include <sys/malloc.h>
#include <sys/conf.h>
#include <sys/device.h>
diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c
index 9f321fa8f7c..1a075c1cd2d 100644
--- a/sys/dev/pci/if_iwn.c
+++ b/sys/dev/pci/if_iwn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwn.c,v 1.3 2007/09/06 19:33:20 damien Exp $ */
+/* $OpenBSD: if_iwn.c,v 1.4 2007/09/07 19:05:05 damien Exp $ */
/*-
* Copyright (c) 2007
@@ -688,15 +688,13 @@ iwn_alloc_tx_ring(struct iwn_softc *sc, struct iwn_tx_ring *ring, int count,
}
ring->data = malloc(count * sizeof (struct iwn_tx_data), M_DEVBUF,
- M_NOWAIT);
+ M_NOWAIT | M_ZERO);
if (ring->data == NULL) {
printf("%s: could not allocate tx data slots\n",
sc->sc_dev.dv_xname);
goto fail;
}
- memset(ring->data, 0, count * sizeof (struct iwn_tx_data));
-
for (i = 0; i < count; i++) {
struct iwn_tx_data *data = &ring->data[i];
@@ -777,12 +775,7 @@ iwn_free_tx_ring(struct iwn_softc *sc, struct iwn_tx_ring *ring)
struct ieee80211_node *
iwn_node_alloc(struct ieee80211com *ic)
{
- struct iwn_node *wn;
-
- wn = malloc(sizeof (struct iwn_node), M_DEVBUF, M_NOWAIT);
- if (wn != NULL)
- memset(wn, 0, sizeof (struct iwn_node));
- return (struct ieee80211_node *)wn;
+ return malloc(sizeof (struct iwn_node), M_DEVBUF, M_NOWAIT | M_ZERO);
}
void
diff --git a/sys/dev/pci/if_nfe.c b/sys/dev/pci/if_nfe.c
index 4e959ec392e..d7555071272 100644
--- a/sys/dev/pci/if_nfe.c
+++ b/sys/dev/pci/if_nfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nfe.c,v 1.70 2007/09/01 19:19:39 ckuethe Exp $ */
+/* $OpenBSD: if_nfe.c,v 1.71 2007/09/07 19:05:05 damien Exp $ */
/*-
* Copyright (c) 2006, 2007 Damien Bergamini <damien.bergamini@free.fr>
@@ -29,7 +29,6 @@
#include <sys/sockio.h>
#include <sys/mbuf.h>
#include <sys/queue.h>
-#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/device.h>
#include <sys/timeout.h>
diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c
index 50bd2faddd1..11255d214c5 100644
--- a/sys/dev/pci/if_wpi.c
+++ b/sys/dev/pci/if_wpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wpi.c,v 1.52 2007/08/28 18:34:38 deraadt Exp $ */
+/* $OpenBSD: if_wpi.c,v 1.53 2007/09/07 19:05:05 damien Exp $ */
/*-
* Copyright (c) 2006, 2007
@@ -648,15 +648,13 @@ wpi_alloc_tx_ring(struct wpi_softc *sc, struct wpi_tx_ring *ring, int count,
}
ring->data = malloc(count * sizeof (struct wpi_tx_data), M_DEVBUF,
- M_NOWAIT);
+ M_NOWAIT | M_ZERO);
if (ring->data == NULL) {
printf("%s: could not allocate tx data slots\n",
sc->sc_dev.dv_xname);
goto fail;
}
- memset(ring->data, 0, count * sizeof (struct wpi_tx_data));
-
for (i = 0; i < count; i++) {
struct wpi_tx_data *data = &ring->data[i];
@@ -735,12 +733,7 @@ wpi_free_tx_ring(struct wpi_softc *sc, struct wpi_tx_ring *ring)
struct ieee80211_node *
wpi_node_alloc(struct ieee80211com *ic)
{
- struct wpi_node *wn;
-
- wn = malloc(sizeof (struct wpi_node), M_DEVBUF, M_NOWAIT);
- if (wn != NULL)
- memset(wn, 0, sizeof (struct wpi_node));
- return (struct ieee80211_node *)wn;
+ return malloc(sizeof (struct wpi_node), M_DEVBUF, M_NOWAIT | M_ZERO);
}
void
diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c
index 400c9a72c49..58dbe188796 100644
--- a/sys/dev/usb/if_ral.c
+++ b/sys/dev/usb/if_ral.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ral.c,v 1.100 2007/07/18 18:10:31 damien Exp $ */
+/* $OpenBSD: if_ral.c,v 1.101 2007/09/07 19:05:05 damien Exp $ */
/*-
* Copyright (c) 2005, 2006
@@ -31,7 +31,6 @@
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/systm.h>
-#include <sys/malloc.h>
#include <sys/timeout.h>
#include <sys/conf.h>
#include <sys/device.h>
diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c
index d5ffcf4f731..d0f7ac2b7fd 100644
--- a/sys/dev/usb/if_rum.c
+++ b/sys/dev/usb/if_rum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_rum.c,v 1.64 2007/06/14 10:11:15 mbalmer Exp $ */
+/* $OpenBSD: if_rum.c,v 1.65 2007/09/07 19:05:05 damien Exp $ */
/*-
* Copyright (c) 2005-2007 Damien Bergamini <damien.bergamini@free.fr>
@@ -31,7 +31,6 @@
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/systm.h>
-#include <sys/malloc.h>
#include <sys/timeout.h>
#include <sys/conf.h>
#include <sys/device.h>
diff --git a/sys/dev/usb/if_uath.c b/sys/dev/usb/if_uath.c
index 73a4d949955..af15c327ed0 100644
--- a/sys/dev/usb/if_uath.c
+++ b/sys/dev/usb/if_uath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_uath.c,v 1.28 2007/08/28 18:34:38 deraadt Exp $ */
+/* $OpenBSD: if_uath.c,v 1.29 2007/09/07 19:05:05 damien Exp $ */
/*-
* Copyright (c) 2006
@@ -37,7 +37,6 @@
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/systm.h>
-#include <sys/malloc.h>
#include <sys/timeout.h>
#include <sys/conf.h>
#include <sys/device.h>
diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c
index 4545ee0729f..db9ec02b625 100644
--- a/sys/dev/usb/if_zyd.c
+++ b/sys/dev/usb/if_zyd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_zyd.c,v 1.59 2007/08/28 18:34:38 deraadt Exp $ */
+/* $OpenBSD: if_zyd.c,v 1.60 2007/09/07 19:05:05 damien Exp $ */
/*-
* Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr>
@@ -643,12 +643,7 @@ zyd_free_rx_list(struct zyd_softc *sc)
struct ieee80211_node *
zyd_node_alloc(struct ieee80211com *ic)
{
- struct zyd_node *zn;
-
- zn = malloc(sizeof (struct zyd_node), M_DEVBUF, M_NOWAIT);
- if (zn != NULL)
- bzero(zn, sizeof (struct zyd_node));
- return (struct ieee80211_node *)zn;
+ return malloc(sizeof (struct zyd_node), M_DEVBUF, M_NOWAIT | M_ZERO);
}
int
diff --git a/sys/dev/usb/ueagle.c b/sys/dev/usb/ueagle.c
index 156bf173f81..a13e87fd199 100644
--- a/sys/dev/usb/ueagle.c
+++ b/sys/dev/usb/ueagle.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ueagle.c,v 1.21 2007/06/14 10:11:15 mbalmer Exp $ */
+/* $OpenBSD: ueagle.c,v 1.22 2007/09/07 19:05:05 damien Exp $ */
/*-
* Copyright (c) 2003-2006
@@ -31,7 +31,6 @@
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/systm.h>
-#include <sys/malloc.h>
#include <sys/device.h>
#include <sys/kthread.h>