summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorDavid Hill <dhill@cvs.openbsd.org>2017-04-11 14:43:50 +0000
committerDavid Hill <dhill@cvs.openbsd.org>2017-04-11 14:43:50 +0000
commit2c104ec6a5078e740dbdfc731d2566fce0a32cd6 (patch)
treefb8c92a0af2fff3345386d64a8d879854cf7d15a /sys/dev
parent52b62a1a7fc6ba6abbae074bf6c70d188c88c54c (diff)
Partially revert previous mallocarray conversions that contain
constants. The consensus is that if both operands are constant, we don't need mallocarray. Reminded by tedu@ ok deraadt@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/aac.c4
-rw-r--r--sys/dev/ic/adw.c4
-rw-r--r--sys/dev/ic/ath.c4
-rw-r--r--sys/dev/pci/azalia.c4
-rw-r--r--sys/dev/pci/if_dc_pci.c4
-rw-r--r--sys/dev/pci/if_nep.c6
-rw-r--r--sys/dev/usb/dwc2/dwc2_hcd.c14
-rw-r--r--sys/dev/wscons/wsemul_vt100.c10
-rw-r--r--sys/dev/wscons/wsevent.c4
9 files changed, 27 insertions, 27 deletions
diff --git a/sys/dev/ic/aac.c b/sys/dev/ic/aac.c
index b6188b64e65..996b32bc901 100644
--- a/sys/dev/ic/aac.c
+++ b/sys/dev/ic/aac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aac.c,v 1.69 2017/04/09 18:07:19 dhill Exp $ */
+/* $OpenBSD: aac.c,v 1.70 2017/04/11 14:43:49 dhill Exp $ */
/*-
* Copyright (c) 2000 Michael Smith
@@ -1277,7 +1277,7 @@ aac_init(struct aac_softc *sc)
/* Allocate some FIBs and associated command structs */
TAILQ_INIT(&sc->aac_fibmap_tqh);
- sc->aac_commands = mallocarray(AAC_MAX_FIBS, sizeof(struct aac_command),
+ sc->aac_commands = malloc(AAC_MAX_FIBS * sizeof(struct aac_command),
M_DEVBUF, M_WAITOK | M_ZERO);
while (sc->total_fibs < AAC_MAX_FIBS) {
if (aac_alloc_commands(sc) != 0)
diff --git a/sys/dev/ic/adw.c b/sys/dev/ic/adw.c
index baebe59b76a..c1efc7f0c13 100644
--- a/sys/dev/ic/adw.c
+++ b/sys/dev/ic/adw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adw.c,v 1.53 2017/04/09 18:07:19 dhill Exp $ */
+/* $OpenBSD: adw.c,v 1.54 2017/04/11 14:43:49 dhill Exp $ */
/* $NetBSD: adw.c,v 1.23 2000/05/27 18:24:50 dante Exp $ */
/*
@@ -144,7 +144,7 @@ adw_alloc_carriers(ADW_SOFTC *sc)
* Allocate the control structure.
*/
sc->sc_control->carriers =
- mallocarray(ADW_MAX_CARRIER, sizeof(ADW_CARRIER), M_DEVBUF,
+ malloc(ADW_MAX_CARRIER * sizeof(ADW_CARRIER), M_DEVBUF,
M_NOWAIT);
if (sc->sc_control->carriers == NULL)
return (ENOMEM);
diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c
index 3a0520da9f4..90f70a1a45d 100644
--- a/sys/dev/ic/ath.c
+++ b/sys/dev/ic/ath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ath.c,v 1.113 2017/04/09 18:07:19 dhill Exp $ */
+/* $OpenBSD: ath.c,v 1.114 2017/04/11 14:43:49 dhill Exp $ */
/* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */
/*-
@@ -2973,7 +2973,7 @@ ath_getchannels(struct ath_softc *sc, HAL_BOOL outdoor, HAL_BOOL xchanmode)
int i, ix, nchan;
sc->sc_nchan = 0;
- chans = mallocarray(IEEE80211_CHAN_MAX, sizeof(HAL_CHANNEL),
+ chans = malloc(IEEE80211_CHAN_MAX * sizeof(HAL_CHANNEL),
M_TEMP, M_NOWAIT);
if (chans == NULL) {
printf("%s: unable to allocate channel table\n", ifp->if_xname);
diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c
index bea16a3005f..308e0adf462 100644
--- a/sys/dev/pci/azalia.c
+++ b/sys/dev/pci/azalia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: azalia.c,v 1.234 2017/04/09 18:16:00 dhill Exp $ */
+/* $OpenBSD: azalia.c,v 1.235 2017/04/11 14:43:49 dhill Exp $ */
/* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */
/*-
@@ -1097,7 +1097,7 @@ azalia_init_rirb(azalia_t *az, int resuming)
DPRINTF(("%s: RIRB allocation succeeded.\n", __func__));
/* setup the unsolicited response queue */
- az->unsolq = mallocarray(UNSOLQ_SIZE, sizeof(rirb_entry_t),
+ az->unsolq = malloc(sizeof(rirb_entry_t) * UNSOLQ_SIZE,
M_DEVBUF, M_NOWAIT | M_ZERO);
if (az->unsolq == NULL) {
DPRINTF(("%s: can't allocate unsolicited response queue.\n",
diff --git a/sys/dev/pci/if_dc_pci.c b/sys/dev/pci/if_dc_pci.c
index ea5bcefdbe6..95a820313ce 100644
--- a/sys/dev/pci/if_dc_pci.c
+++ b/sys/dev/pci/if_dc_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_dc_pci.c,v 1.75 2017/04/09 18:16:00 dhill Exp $ */
+/* $OpenBSD: if_dc_pci.c,v 1.76 2017/04/11 14:43:49 dhill Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -360,7 +360,7 @@ dc_pci_attach(struct device *parent, struct device *self, void *aux)
sc->dc_type = DC_TYPE_PNIC;
sc->dc_flags |= DC_TX_STORENFWD|DC_TX_INTR_ALWAYS;
sc->dc_flags |= DC_PNIC_RX_BUG_WAR;
- sc->dc_pnic_rx_buf = mallocarray(5, ETHER_MAX_DIX_LEN,
+ sc->dc_pnic_rx_buf = malloc(ETHER_MAX_DIX_LEN * 5,
M_DEVBUF, M_NOWAIT);
if (sc->dc_pnic_rx_buf == NULL)
panic("dc_pci_attach");
diff --git a/sys/dev/pci/if_nep.c b/sys/dev/pci/if_nep.c
index f22efe0d718..3104b8c63af 100644
--- a/sys/dev/pci/if_nep.c
+++ b/sys/dev/pci/if_nep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nep.c,v 1.29 2017/04/09 19:59:43 deraadt Exp $ */
+/* $OpenBSD: if_nep.c,v 1.30 2017/04/11 14:43:49 dhill Exp $ */
/*
* Copyright (c) 2014, 2015 Mark Kettenis
*
@@ -1561,7 +1561,7 @@ nep_up(struct nep_softc *sc)
return;
sc->sc_rbdesc = NEP_DMA_KVA(sc->sc_rbring);
- sc->sc_rb = mallocarray(NEP_NRBDESC, sizeof(struct nep_block),
+ sc->sc_rb = malloc(sizeof(struct nep_block) * NEP_NRBDESC,
M_DEVBUF, M_WAITOK);
for (i = 0; i < NEP_NRBDESC; i++) {
rb = &sc->sc_rb[i];
@@ -1592,7 +1592,7 @@ nep_up(struct nep_softc *sc)
goto free_rxmbox;
sc->sc_txdesc = NEP_DMA_KVA(sc->sc_txring);
- sc->sc_txbuf = mallocarray(NEP_NTXDESC, sizeof(struct nep_buf),
+ sc->sc_txbuf = malloc(sizeof(struct nep_buf) * NEP_NTXDESC,
M_DEVBUF, M_WAITOK);
for (i = 0; i < NEP_NTXDESC; i++) {
txb = &sc->sc_txbuf[i];
diff --git a/sys/dev/usb/dwc2/dwc2_hcd.c b/sys/dev/usb/dwc2/dwc2_hcd.c
index dee59662862..e42e6d427c4 100644
--- a/sys/dev/usb/dwc2/dwc2_hcd.c
+++ b/sys/dev/usb/dwc2/dwc2_hcd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwc2_hcd.c,v 1.17 2017/04/09 18:09:41 dhill Exp $ */
+/* $OpenBSD: dwc2_hcd.c,v 1.18 2017/04/11 14:43:49 dhill Exp $ */
/* $NetBSD: dwc2_hcd.c,v 1.15 2014/11/24 10:14:14 skrll Exp $ */
/*
@@ -2184,14 +2184,14 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg,
dev_dbg(hsotg->dev, "hcfg=%08x\n", DWC2_READ_4(hsotg, HCFG));
#ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS
- hsotg->frame_num_array = mallocarray(FRAME_NUM_ARRAY_SIZE,
- sizeof(*hsotg->frame_num_array),
- M_DEVBUF, M_ZERO | M_WAITOK);
+ hsotg->frame_num_array = malloc(sizeof(*hsotg->frame_num_array) *
+ FRAME_NUM_ARRAY_SIZE, M_DEVBUF,
+ M_ZERO | M_WAITOK);
if (!hsotg->frame_num_array)
goto error1;
- hsotg->last_frame_num_array = mallocarray(FRAME_NUM_ARRAY_SIZE,
- sizeof(*hsotg->last_frame_num_array),
- M_DEVBUF, M_ZERO | M_WAITOK);
+ hsotg->last_frame_num_array = malloc(
+ sizeof(*hsotg->last_frame_num_array) *
+ FRAME_NUM_ARRAY_SIZE, M_DEVBUF, M_ZERO | M_WAITOK);
if (!hsotg->last_frame_num_array)
goto error1;
hsotg->last_frame_num = HFNUM_MAX_FRNUM;
diff --git a/sys/dev/wscons/wsemul_vt100.c b/sys/dev/wscons/wsemul_vt100.c
index 6d90d906583..0e4ee7a93f9 100644
--- a/sys/dev/wscons/wsemul_vt100.c
+++ b/sys/dev/wscons/wsemul_vt100.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsemul_vt100.c,v 1.34 2017/04/09 18:05:17 dhill Exp $ */
+/* $OpenBSD: wsemul_vt100.c,v 1.35 2017/04/11 14:43:49 dhill Exp $ */
/* $NetBSD: wsemul_vt100.c,v 1.13 2000/04/28 21:56:16 mycroft Exp $ */
/*
@@ -222,10 +222,10 @@ wsemul_vt100_attach(int console, const struct wsscreen_descr *type,
edp->dblwid = malloc(edp->nrows, M_DEVBUF, M_NOWAIT | M_ZERO);
edp->dw = 0;
edp->dcsarg = malloc(DCS_MAXLEN, M_DEVBUF, M_NOWAIT);
- edp->isolatin1tab = mallocarray(128, sizeof(u_int), M_DEVBUF, M_NOWAIT);
- edp->decgraphtab = mallocarray(128, sizeof(u_int), M_DEVBUF, M_NOWAIT);
- edp->dectechtab = mallocarray(128, sizeof(u_int), M_DEVBUF, M_NOWAIT);
- edp->nrctab = mallocarray(128, sizeof(u_int), M_DEVBUF, M_NOWAIT);
+ edp->isolatin1tab = malloc(128 * sizeof(u_int), M_DEVBUF, M_NOWAIT);
+ edp->decgraphtab = malloc(128 * sizeof(u_int), M_DEVBUF, M_NOWAIT);
+ edp->dectechtab = malloc(128 * sizeof(u_int), M_DEVBUF, M_NOWAIT);
+ edp->nrctab = malloc(128 * sizeof(u_int), M_DEVBUF, M_NOWAIT);
vt100_initchartables(edp);
wsemul_vt100_reset(edp);
return (edp);
diff --git a/sys/dev/wscons/wsevent.c b/sys/dev/wscons/wsevent.c
index 37bbeb66172..52e0096440b 100644
--- a/sys/dev/wscons/wsevent.c
+++ b/sys/dev/wscons/wsevent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsevent.c,v 1.16 2017/04/09 18:05:17 dhill Exp $ */
+/* $OpenBSD: wsevent.c,v 1.17 2017/04/11 14:43:49 dhill Exp $ */
/* $NetBSD: wsevent.c,v 1.16 2003/08/07 16:31:29 agc Exp $ */
/*
@@ -109,7 +109,7 @@ wsevent_init(struct wseventvar *ev)
return;
}
ev->get = ev->put = 0;
- ev->q = mallocarray(WSEVENT_QSIZE, sizeof(struct wscons_event),
+ ev->q = malloc(WSEVENT_QSIZE * sizeof(struct wscons_event),
M_DEVBUF, M_WAITOK | M_ZERO);
}