aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp/ipoib/ipoib_cm.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-11-04 23:07:36 -0400
committerRoland Dreier <rolandd@cisco.com>2011-01-12 14:11:58 -0500
commit948579cd8c6ea7c8c98c52b79f4470952e182ebd (patch)
tree77e85adbdd07be8394fa60d08d3f1dbda3c67393 /drivers/infiniband/ulp/ipoib/ipoib_cm.c
parent4162cf64973df51fc885825bc9ca4d055891c49f (diff)
RDMA: Use vzalloc() to replace vmalloc()+memset(0)
Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/ulp/ipoib/ipoib_cm.c')
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index c1c49f2d35b5..93d55806b967 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -352,15 +352,13 @@ static int ipoib_cm_nonsrq_init_rx(struct net_device *dev, struct ib_cm_id *cm_i
352 int ret; 352 int ret;
353 int i; 353 int i;
354 354
355 rx->rx_ring = vmalloc(ipoib_recvq_size * sizeof *rx->rx_ring); 355 rx->rx_ring = vzalloc(ipoib_recvq_size * sizeof *rx->rx_ring);
356 if (!rx->rx_ring) { 356 if (!rx->rx_ring) {
357 printk(KERN_WARNING "%s: failed to allocate CM non-SRQ ring (%d entries)\n", 357 printk(KERN_WARNING "%s: failed to allocate CM non-SRQ ring (%d entries)\n",
358 priv->ca->name, ipoib_recvq_size); 358 priv->ca->name, ipoib_recvq_size);
359 return -ENOMEM; 359 return -ENOMEM;
360 } 360 }
361 361
362 memset(rx->rx_ring, 0, ipoib_recvq_size * sizeof *rx->rx_ring);
363
364 t = kmalloc(sizeof *t, GFP_KERNEL); 362 t = kmalloc(sizeof *t, GFP_KERNEL);
365 if (!t) { 363 if (!t) {
366 ret = -ENOMEM; 364 ret = -ENOMEM;
@@ -1097,13 +1095,12 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn,
1097 struct ipoib_dev_priv *priv = netdev_priv(p->dev); 1095 struct ipoib_dev_priv *priv = netdev_priv(p->dev);
1098 int ret; 1096 int ret;
1099 1097
1100 p->tx_ring = vmalloc(ipoib_sendq_size * sizeof *p->tx_ring); 1098 p->tx_ring = vzalloc(ipoib_sendq_size * sizeof *p->tx_ring);
1101 if (!p->tx_ring) { 1099 if (!p->tx_ring) {
1102 ipoib_warn(priv, "failed to allocate tx ring\n"); 1100 ipoib_warn(priv, "failed to allocate tx ring\n");
1103 ret = -ENOMEM; 1101 ret = -ENOMEM;
1104 goto err_tx; 1102 goto err_tx;
1105 } 1103 }
1106 memset(p->tx_ring, 0, ipoib_sendq_size * sizeof *p->tx_ring);
1107 1104
1108 p->qp = ipoib_cm_create_tx_qp(p->dev, p); 1105 p->qp = ipoib_cm_create_tx_qp(p->dev, p);
1109 if (IS_ERR(p->qp)) { 1106 if (IS_ERR(p->qp)) {
@@ -1521,7 +1518,7 @@ static void ipoib_cm_create_srq(struct net_device *dev, int max_sge)
1521 return; 1518 return;
1522 } 1519 }
1523 1520
1524 priv->cm.srq_ring = vmalloc(ipoib_recvq_size * sizeof *priv->cm.srq_ring); 1521 priv->cm.srq_ring = vzalloc(ipoib_recvq_size * sizeof *priv->cm.srq_ring);
1525 if (!priv->cm.srq_ring) { 1522 if (!priv->cm.srq_ring) {
1526 printk(KERN_WARNING "%s: failed to allocate CM SRQ ring (%d entries)\n", 1523 printk(KERN_WARNING "%s: failed to allocate CM SRQ ring (%d entries)\n",
1527 priv->ca->name, ipoib_recvq_size); 1524 priv->ca->name, ipoib_recvq_size);
@@ -1530,7 +1527,6 @@ static void ipoib_cm_create_srq(struct net_device *dev, int max_sge)
1530 return; 1527 return;
1531 } 1528 }
1532 1529
1533 memset(priv->cm.srq_ring, 0, ipoib_recvq_size * sizeof *priv->cm.srq_ring);
1534} 1530}
1535 1531
1536int ipoib_cm_dev_init(struct net_device *dev) 1532int ipoib_cm_dev_init(struct net_device *dev)