[IB] kzalloc() conversions
Replace kmalloc()+memset(,0,) with kzalloc(), for a net savings of 35 source lines and about 500 bytes of text. Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
@ -729,25 +729,21 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port)
|
||||
|
||||
/* Allocate RX/TX "rings" to hold queued skbs */
|
||||
|
||||
priv->rx_ring = kmalloc(IPOIB_RX_RING_SIZE * sizeof (struct ipoib_rx_buf),
|
||||
priv->rx_ring = kzalloc(IPOIB_RX_RING_SIZE * sizeof (struct ipoib_rx_buf),
|
||||
GFP_KERNEL);
|
||||
if (!priv->rx_ring) {
|
||||
printk(KERN_WARNING "%s: failed to allocate RX ring (%d entries)\n",
|
||||
ca->name, IPOIB_RX_RING_SIZE);
|
||||
goto out;
|
||||
}
|
||||
memset(priv->rx_ring, 0,
|
||||
IPOIB_RX_RING_SIZE * sizeof (struct ipoib_rx_buf));
|
||||
|
||||
priv->tx_ring = kmalloc(IPOIB_TX_RING_SIZE * sizeof (struct ipoib_tx_buf),
|
||||
priv->tx_ring = kzalloc(IPOIB_TX_RING_SIZE * sizeof (struct ipoib_tx_buf),
|
||||
GFP_KERNEL);
|
||||
if (!priv->tx_ring) {
|
||||
printk(KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n",
|
||||
ca->name, IPOIB_TX_RING_SIZE);
|
||||
goto out_rx_ring_cleanup;
|
||||
}
|
||||
memset(priv->tx_ring, 0,
|
||||
IPOIB_TX_RING_SIZE * sizeof (struct ipoib_tx_buf));
|
||||
|
||||
/* priv->tx_head & tx_tail are already 0 */
|
||||
|
||||
|
@ -135,12 +135,10 @@ static struct ipoib_mcast *ipoib_mcast_alloc(struct net_device *dev,
|
||||
{
|
||||
struct ipoib_mcast *mcast;
|
||||
|
||||
mcast = kmalloc(sizeof (*mcast), can_sleep ? GFP_KERNEL : GFP_ATOMIC);
|
||||
mcast = kzalloc(sizeof *mcast, can_sleep ? GFP_KERNEL : GFP_ATOMIC);
|
||||
if (!mcast)
|
||||
return NULL;
|
||||
|
||||
memset(mcast, 0, sizeof (*mcast));
|
||||
|
||||
init_completion(&mcast->done);
|
||||
|
||||
mcast->dev = dev;
|
||||
|
Reference in New Issue
Block a user