ethernet: Remove unnecessary alloc/OOM messages, alloc cleanups
alloc failures already get standardized OOM messages and a dump_stack. Convert kzalloc's with multiplies to kcalloc. Convert kmalloc's with multiplies to kmalloc_array. Fix a few whitespace defects. Convert a constant 6 to ETH_ALEN. Use parentheses around sizeof. Convert vmalloc/memset to vzalloc. Remove now unused size variables. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
09da6c5f60
commit
b2adaca92c
@@ -891,18 +891,16 @@ static int sh_eth_ring_init(struct net_device *ndev)
|
||||
mdp->rx_buf_sz += NET_IP_ALIGN;
|
||||
|
||||
/* Allocate RX and TX skb rings */
|
||||
mdp->rx_skbuff = kmalloc(sizeof(*mdp->rx_skbuff) * mdp->num_rx_ring,
|
||||
GFP_KERNEL);
|
||||
mdp->rx_skbuff = kmalloc_array(mdp->num_rx_ring,
|
||||
sizeof(*mdp->rx_skbuff), GFP_KERNEL);
|
||||
if (!mdp->rx_skbuff) {
|
||||
dev_err(&ndev->dev, "Cannot allocate Rx skb\n");
|
||||
ret = -ENOMEM;
|
||||
return ret;
|
||||
}
|
||||
|
||||
mdp->tx_skbuff = kmalloc(sizeof(*mdp->tx_skbuff) * mdp->num_tx_ring,
|
||||
GFP_KERNEL);
|
||||
mdp->tx_skbuff = kmalloc_array(mdp->num_tx_ring,
|
||||
sizeof(*mdp->tx_skbuff), GFP_KERNEL);
|
||||
if (!mdp->tx_skbuff) {
|
||||
dev_err(&ndev->dev, "Cannot allocate Tx skb\n");
|
||||
ret = -ENOMEM;
|
||||
goto skb_ring_free;
|
||||
}
|
||||
|
Reference in New Issue
Block a user