aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2005-11-02 10:23:14 -0500
committerRoland Dreier <rolandd@cisco.com>2005-11-02 10:23:14 -0500
commitde6eb66b56d9df5ce6bd254994f05e065214e8cd (patch)
tree7463446a05b5e9a5d2fc400da0be8d4a6c2ff6f1 /drivers/infiniband/ulp
parent7b28b0d000eeb62d77add636f5d6eb0da04e48aa (diff)
[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>
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c8
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c4
2 files changed, 3 insertions, 9 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 273d5f418a67..8b67db868306 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -729,25 +729,21 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port)
729 729
730 /* Allocate RX/TX "rings" to hold queued skbs */ 730 /* Allocate RX/TX "rings" to hold queued skbs */
731 731
732 priv->rx_ring = kmalloc(IPOIB_RX_RING_SIZE * sizeof (struct ipoib_rx_buf), 732 priv->rx_ring = kzalloc(IPOIB_RX_RING_SIZE * sizeof (struct ipoib_rx_buf),
733 GFP_KERNEL); 733 GFP_KERNEL);
734 if (!priv->rx_ring) { 734 if (!priv->rx_ring) {
735 printk(KERN_WARNING "%s: failed to allocate RX ring (%d entries)\n", 735 printk(KERN_WARNING "%s: failed to allocate RX ring (%d entries)\n",
736 ca->name, IPOIB_RX_RING_SIZE); 736 ca->name, IPOIB_RX_RING_SIZE);
737 goto out; 737 goto out;
738 } 738 }
739 memset(priv->rx_ring, 0,
740 IPOIB_RX_RING_SIZE * sizeof (struct ipoib_rx_buf));
741 739
742 priv->tx_ring = kmalloc(IPOIB_TX_RING_SIZE * sizeof (struct ipoib_tx_buf), 740 priv->tx_ring = kzalloc(IPOIB_TX_RING_SIZE * sizeof (struct ipoib_tx_buf),
743 GFP_KERNEL); 741 GFP_KERNEL);
744 if (!priv->tx_ring) { 742 if (!priv->tx_ring) {
745 printk(KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n", 743 printk(KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n",
746 ca->name, IPOIB_TX_RING_SIZE); 744 ca->name, IPOIB_TX_RING_SIZE);
747 goto out_rx_ring_cleanup; 745 goto out_rx_ring_cleanup;
748 } 746 }
749 memset(priv->tx_ring, 0,
750 IPOIB_TX_RING_SIZE * sizeof (struct ipoib_tx_buf));
751 747
752 /* priv->tx_head & tx_tail are already 0 */ 748 /* priv->tx_head & tx_tail are already 0 */
753 749
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index 36ce29836bf2..022eec730751 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -135,12 +135,10 @@ static struct ipoib_mcast *ipoib_mcast_alloc(struct net_device *dev,
135{ 135{
136 struct ipoib_mcast *mcast; 136 struct ipoib_mcast *mcast;
137 137
138 mcast = kmalloc(sizeof (*mcast), can_sleep ? GFP_KERNEL : GFP_ATOMIC); 138 mcast = kzalloc(sizeof *mcast, can_sleep ? GFP_KERNEL : GFP_ATOMIC);
139 if (!mcast) 139 if (!mcast)
140 return NULL; 140 return NULL;
141 141
142 memset(mcast, 0, sizeof (*mcast));
143
144 init_completion(&mcast->done); 142 init_completion(&mcast->done);
145 143
146 mcast->dev = dev; 144 mcast->dev = dev;