aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ral
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2018-01-21 15:42:36 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2018-01-21 15:42:36 +0000
commitac2fffa4b74cd83963f0d462c379c7f50eeabf20 (patch)
tree1f8fc635121499d467998c99ece5983a2d563840 /sys/dev/ral
parente09304d8f33887be9cc37817885061ccbb770d50 (diff)
downloadsrc-ac2fffa4b74cd83963f0d462c379c7f50eeabf20.tar.gz
src-ac2fffa4b74cd83963f0d462c379c7f50eeabf20.zip
Revert r327828, r327949, r327953, r328016-r328026, r328041:
Uses of mallocarray(9). The use of mallocarray(9) has rocketed the required swap to build FreeBSD. This is likely caused by the allocation size attributes which put extra pressure on the compiler. Given that most of these checks are superfluous we have to choose better where to use mallocarray(9). We still have more uses of mallocarray(9) but hopefully this is enough to bring swap usage to a reasonable level. Reported by: wosch PR: 225197
Notes
Notes: svn path=/head/; revision=328218
Diffstat (limited to 'sys/dev/ral')
-rw-r--r--sys/dev/ral/rt2560.c6
-rw-r--r--sys/dev/ral/rt2661.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/ral/rt2560.c b/sys/dev/ral/rt2560.c
index ce396dc81094..9da26a8f581a 100644
--- a/sys/dev/ral/rt2560.c
+++ b/sys/dev/ral/rt2560.c
@@ -488,7 +488,7 @@ rt2560_alloc_tx_ring(struct rt2560_softc *sc, struct rt2560_tx_ring *ring,
goto fail;
}
- ring->data = mallocarray(count, sizeof(struct rt2560_tx_data), M_DEVBUF,
+ ring->data = malloc(count * sizeof (struct rt2560_tx_data), M_DEVBUF,
M_NOWAIT | M_ZERO);
if (ring->data == NULL) {
device_printf(sc->sc_dev, "could not allocate soft data\n");
@@ -632,8 +632,8 @@ rt2560_alloc_rx_ring(struct rt2560_softc *sc, struct rt2560_rx_ring *ring,
goto fail;
}
- ring->data = mallocarray(count, sizeof (struct rt2560_rx_data),
- M_DEVBUF, M_NOWAIT | M_ZERO);
+ ring->data = malloc(count * sizeof (struct rt2560_rx_data), M_DEVBUF,
+ M_NOWAIT | M_ZERO);
if (ring->data == NULL) {
device_printf(sc->sc_dev, "could not allocate soft data\n");
error = ENOMEM;
diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c
index 55dedd4eaba6..aab385a5855f 100644
--- a/sys/dev/ral/rt2661.c
+++ b/sys/dev/ral/rt2661.c
@@ -497,7 +497,7 @@ rt2661_alloc_tx_ring(struct rt2661_softc *sc, struct rt2661_tx_ring *ring,
goto fail;
}
- ring->data = mallocarray(count, sizeof(struct rt2661_tx_data), M_DEVBUF,
+ ring->data = malloc(count * sizeof (struct rt2661_tx_data), M_DEVBUF,
M_NOWAIT | M_ZERO);
if (ring->data == NULL) {
device_printf(sc->sc_dev, "could not allocate soft data\n");
@@ -638,7 +638,7 @@ rt2661_alloc_rx_ring(struct rt2661_softc *sc, struct rt2661_rx_ring *ring,
goto fail;
}
- ring->data = mallocarray(count, sizeof(struct rt2661_rx_data), M_DEVBUF,
+ ring->data = malloc(count * sizeof (struct rt2661_rx_data), M_DEVBUF,
M_NOWAIT | M_ZERO);
if (ring->data == NULL) {
device_printf(sc->sc_dev, "could not allocate soft data\n");