[openib-general] [PATCH]ipoib_dev_init returns correctly

Shirley Ma xma at us.ibm.com
Sun Mar 26 12:34:45 PST 2006


Roland,

This is a small fix for ipoib_dev_init() to return the right value. 
ipoib_ib_dev_init() could return -ENODEV. Attachment is the patch file.

Signed-off-by: Shirley Ma <xma at us.ibm.com>

diff -urN infiniband/ulp/ipoib/ipoib_main.c 
infiniband-return/ulp/ipoib/ipoib_main.c
--- infiniband/ulp/ipoib/ipoib_main.c   2006-03-26 11:57:15.750051312 
-0800
+++ infiniband-return/ulp/ipoib/ipoib_main.c    2006-03-26 
12:26:14.548713736 -0800
@@ -840,6 +840,7 @@
 int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int 
port)
 {
        struct ipoib_dev_priv *priv = netdev_priv(dev);
+       int ret;
 
        /* Allocate RX/TX "rings" to hold queued skbs */
 
@@ -848,6 +849,7 @@
        if (!priv->rx_ring) {
                printk(KERN_WARNING "%s: failed to allocate RX ring (%d 
entries)\n",
                       ca->name, IPOIB_RX_RING_SIZE);
+               ret = -ENOMEM;
                goto out;
        }
 
@@ -856,24 +858,23 @@
        if (!priv->tx_ring) {
                printk(KERN_WARNING "%s: failed to allocate TX ring (%d 
entries)\n",
                       ca->name, IPOIB_TX_RING_SIZE);
+               ret = -ENOMEM;
                goto out_rx_ring_cleanup;
        }
 
        /* priv->tx_head & tx_tail are already 0 */
 
-       if (ipoib_ib_dev_init(dev, ca, port))
-               goto out_tx_ring_cleanup;
-
-       return 0;
+       ret = ipoib_ib_dev_init(dev, ca, port);
+       if (!ret)
+               goto out;
 
-out_tx_ring_cleanup:
        kfree(priv->tx_ring);
 
 out_rx_ring_cleanup:
        kfree(priv->rx_ring);
 
 out:
-       return -ENOMEM;
+       return ret;
 }
 
 void ipoib_dev_cleanup(struct net_device *dev)



Thanks
Shirley Ma
IBM Linux Technology Center
15300 SW Koll Parkway
Beaverton, OR 97006-6063
Phone(Fax): (503) 578-7638

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20060326/8696946d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: infiniband-return.patch
Type: application/octet-stream
Size: 1248 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20060326/8696946d/attachment.obj>


More information about the general mailing list