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:
Joe Perches
2013-02-07 11:46:27 +00:00
committato da David S. Miller
parent e9ba103931
commit 14f8dc4953
20 ha cambiato i file con 66 aggiunte e 150 eliminazioni

Vedi File

@@ -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;
}

Vedi File

@@ -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 */