drivers: net: Remove remaining alloc/OOM messages
alloc failures already get standardized OOM messages and a dump_stack. For the affected mallocs around these OOM messages: Converted kmallocs with multiplies to kmalloc_array. Converted a kmalloc/memcpy to kmemdup. Removed now unused stack variables. Removed unnecessary parentheses. Neatened alignment. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Arend van Spriel <arend@broadcom.com> Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> Acked-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
e9ba103931
commit
14f8dc4953
@@ -1196,20 +1196,17 @@ void ath9k_rx_cleanup(struct ath9k_htc_priv *priv)
|
||||
|
||||
int ath9k_rx_init(struct ath9k_htc_priv *priv)
|
||||
{
|
||||
struct ath_hw *ah = priv->ah;
|
||||
struct ath_common *common = ath9k_hw_common(ah);
|
||||
struct ath9k_htc_rxbuf *rxbuf;
|
||||
int i = 0;
|
||||
|
||||
INIT_LIST_HEAD(&priv->rx.rxbuf);
|
||||
spin_lock_init(&priv->rx.rxbuflock);
|
||||
|
||||
for (i = 0; i < ATH9K_HTC_RXBUF; i++) {
|
||||
rxbuf = kzalloc(sizeof(struct ath9k_htc_rxbuf), GFP_KERNEL);
|
||||
if (rxbuf == NULL) {
|
||||
ath_err(common, "Unable to allocate RX buffers\n");
|
||||
struct ath9k_htc_rxbuf *rxbuf =
|
||||
kzalloc(sizeof(struct ath9k_htc_rxbuf), GFP_KERNEL);
|
||||
if (rxbuf == NULL)
|
||||
goto err;
|
||||
}
|
||||
|
||||
list_add_tail(&rxbuf->list, &priv->rx.rxbuf);
|
||||
}
|
||||
|
||||
|
@@ -2981,13 +2981,8 @@ struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
|
||||
struct ath_gen_timer *timer;
|
||||
|
||||
timer = kzalloc(sizeof(struct ath_gen_timer), GFP_KERNEL);
|
||||
|
||||
if (timer == NULL) {
|
||||
ath_err(ath9k_hw_common(ah),
|
||||
"Failed to allocate memory for hw timer[%d]\n",
|
||||
timer_index);
|
||||
if (timer == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* allocate a hardware generic timer slot */
|
||||
timer_table->timers[timer_index] = timer;
|
||||
|
@@ -1452,17 +1452,7 @@ static void ath_rate_free(void *priv)
|
||||
|
||||
static void *ath_rate_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
|
||||
{
|
||||
struct ath_softc *sc = priv;
|
||||
struct ath_rate_priv *rate_priv;
|
||||
|
||||
rate_priv = kzalloc(sizeof(struct ath_rate_priv), gfp);
|
||||
if (!rate_priv) {
|
||||
ath_err(ath9k_hw_common(sc->sc_ah),
|
||||
"Unable to allocate private rc structure\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return rate_priv;
|
||||
return kzalloc(sizeof(struct ath_rate_priv), gfp);
|
||||
}
|
||||
|
||||
static void ath_rate_free_sta(void *priv, struct ieee80211_sta *sta,
|
||||
|
@@ -74,8 +74,6 @@ static int wil_vring_alloc(struct wil6210_priv *wil, struct vring *vring)
|
||||
vring->swtail = 0;
|
||||
vring->ctx = kzalloc(vring->size * sizeof(vring->ctx[0]), GFP_KERNEL);
|
||||
if (!vring->ctx) {
|
||||
wil_err(wil, "vring_alloc [%d] failed to alloc ctx mem\n",
|
||||
vring->size);
|
||||
vring->va = NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@@ -587,11 +587,9 @@ void wmi_recv_cmd(struct wil6210_priv *wil)
|
||||
evt = kmalloc(ALIGN(offsetof(struct pending_wmi_event,
|
||||
event.wmi) + len, 4),
|
||||
GFP_KERNEL);
|
||||
if (!evt) {
|
||||
wil_err(wil, "kmalloc for WMI event (%d) failed\n",
|
||||
len);
|
||||
if (!evt)
|
||||
return;
|
||||
}
|
||||
|
||||
evt->event.hdr = hdr;
|
||||
cmd = (void *)&evt->event.wmi;
|
||||
wil_memcpy_fromio_32(cmd, src, len);
|
||||
@@ -838,10 +836,8 @@ int wmi_set_ie(struct wil6210_priv *wil, u8 type, u16 ie_len, const void *ie)
|
||||
int rc;
|
||||
u16 len = sizeof(struct wmi_set_appie_cmd) + ie_len;
|
||||
struct wmi_set_appie_cmd *cmd = kzalloc(len, GFP_KERNEL);
|
||||
if (!cmd) {
|
||||
wil_err(wil, "kmalloc(%d) failed\n", len);
|
||||
if (!cmd)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
cmd->mgmt_frm_type = type;
|
||||
/* BUG: FW API define ieLen as u8. Will fix FW */
|
||||
|
Reference in New Issue
Block a user