aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/myri10ge
diff options
context:
space:
mode:
authorBrice Goglin <brice@myri.com>2007-03-07 13:59:52 -0500
committerJeff Garzik <jeff@garzik.org>2007-03-09 11:51:31 -0500
commit355c7265f4745a2aa6f0482d466e2271e6b3c61a (patch)
treeae8ac39636bb84d9a051b08ee5fd61697e625fe7 /drivers/net/myri10ge
parentb8d095d782fa1e97d5dc05c08ba32c8eb28b85e4 (diff)
myri10ge: fix error checking and return value in myri10ge_allocate_rings
Fix a missing error check in myri10ge_allocate_rings() and set status to -ENOMEM before all actual allocations so that the error path returns what it should. Signed-off-by: Brice Goglin <brice@myri.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/myri10ge')
-rw-r--r--drivers/net/myri10ge/myri10ge.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index b05dc6ed7fb7..db282ed9ab7d 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -1456,6 +1456,8 @@ static int myri10ge_allocate_rings(struct net_device *dev)
1456 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_SEND_RING_SIZE, &cmd, 0); 1456 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_SEND_RING_SIZE, &cmd, 0);
1457 tx_ring_size = cmd.data0; 1457 tx_ring_size = cmd.data0;
1458 status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_RX_RING_SIZE, &cmd, 0); 1458 status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_RX_RING_SIZE, &cmd, 0);
1459 if (status != 0)
1460 return status;
1459 rx_ring_size = cmd.data0; 1461 rx_ring_size = cmd.data0;
1460 1462
1461 tx_ring_entries = tx_ring_size / sizeof(struct mcp_kreq_ether_send); 1463 tx_ring_entries = tx_ring_size / sizeof(struct mcp_kreq_ether_send);
@@ -1463,6 +1465,8 @@ static int myri10ge_allocate_rings(struct net_device *dev)
1463 mgp->tx.mask = tx_ring_entries - 1; 1465 mgp->tx.mask = tx_ring_entries - 1;
1464 mgp->rx_small.mask = mgp->rx_big.mask = rx_ring_entries - 1; 1466 mgp->rx_small.mask = mgp->rx_big.mask = rx_ring_entries - 1;
1465 1467
1468 status = -ENOMEM;
1469
1466 /* allocate the host shadow rings */ 1470 /* allocate the host shadow rings */
1467 1471
1468 bytes = 8 + (MYRI10GE_MAX_SEND_DESC_TSO + 4) 1472 bytes = 8 + (MYRI10GE_MAX_SEND_DESC_TSO + 4)