aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/efx.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2008-09-01 07:48:46 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-09-03 09:53:48 -0400
commitbc3c90a2b70652b87cde8de65275d6f41d0f24c3 (patch)
tree3d9a7eebad85bc86f5a3fbd4fdf4cc2b7be950a4 /drivers/net/sfc/efx.c
parentc1e5fcc980b7b2185b29e4f9f0d8266806ada9eb (diff)
sfc: Remove some unreachable error paths
Some functions return an error code which is always 0. Change their return types to void and simplify their callers accordingly. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/sfc/efx.c')
-rw-r--r--drivers/net/sfc/efx.c76
1 files changed, 18 insertions, 58 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index c41035a99381..f226dcf18c7d 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -282,13 +282,13 @@ static int efx_probe_eventq(struct efx_channel *channel)
282} 282}
283 283
284/* Prepare channel's event queue */ 284/* Prepare channel's event queue */
285static int efx_init_eventq(struct efx_channel *channel) 285static void efx_init_eventq(struct efx_channel *channel)
286{ 286{
287 EFX_LOG(channel->efx, "chan %d init event queue\n", channel->channel); 287 EFX_LOG(channel->efx, "chan %d init event queue\n", channel->channel);
288 288
289 channel->eventq_read_ptr = 0; 289 channel->eventq_read_ptr = 0;
290 290
291 return falcon_init_eventq(channel); 291 falcon_init_eventq(channel);
292} 292}
293 293
294static void efx_fini_eventq(struct efx_channel *channel) 294static void efx_fini_eventq(struct efx_channel *channel)
@@ -354,12 +354,11 @@ static int efx_probe_channel(struct efx_channel *channel)
354 * to propagate configuration changes (mtu, checksum offload), or 354 * to propagate configuration changes (mtu, checksum offload), or
355 * to clear hardware error conditions 355 * to clear hardware error conditions
356 */ 356 */
357static int efx_init_channels(struct efx_nic *efx) 357static void efx_init_channels(struct efx_nic *efx)
358{ 358{
359 struct efx_tx_queue *tx_queue; 359 struct efx_tx_queue *tx_queue;
360 struct efx_rx_queue *rx_queue; 360 struct efx_rx_queue *rx_queue;
361 struct efx_channel *channel; 361 struct efx_channel *channel;
362 int rc = 0;
363 362
364 /* Calculate the rx buffer allocation parameters required to 363 /* Calculate the rx buffer allocation parameters required to
365 * support the current MTU, including padding for header 364 * support the current MTU, including padding for header
@@ -374,36 +373,20 @@ static int efx_init_channels(struct efx_nic *efx)
374 efx_for_each_channel(channel, efx) { 373 efx_for_each_channel(channel, efx) {
375 EFX_LOG(channel->efx, "init chan %d\n", channel->channel); 374 EFX_LOG(channel->efx, "init chan %d\n", channel->channel);
376 375
377 rc = efx_init_eventq(channel); 376 efx_init_eventq(channel);
378 if (rc)
379 goto err;
380 377
381 efx_for_each_channel_tx_queue(tx_queue, channel) { 378 efx_for_each_channel_tx_queue(tx_queue, channel)
382 rc = efx_init_tx_queue(tx_queue); 379 efx_init_tx_queue(tx_queue);
383 if (rc)
384 goto err;
385 }
386 380
387 /* The rx buffer allocation strategy is MTU dependent */ 381 /* The rx buffer allocation strategy is MTU dependent */
388 efx_rx_strategy(channel); 382 efx_rx_strategy(channel);
389 383
390 efx_for_each_channel_rx_queue(rx_queue, channel) { 384 efx_for_each_channel_rx_queue(rx_queue, channel)
391 rc = efx_init_rx_queue(rx_queue); 385 efx_init_rx_queue(rx_queue);
392 if (rc)
393 goto err;
394 }
395 386
396 WARN_ON(channel->rx_pkt != NULL); 387 WARN_ON(channel->rx_pkt != NULL);
397 efx_rx_strategy(channel); 388 efx_rx_strategy(channel);
398 } 389 }
399
400 return 0;
401
402 err:
403 EFX_ERR(efx, "failed to initialise channel %d\n",
404 channel ? channel->channel : -1);
405 efx_fini_channels(efx);
406 return rc;
407} 390}
408 391
409/* This enables event queue processing and packet transmission. 392/* This enables event queue processing and packet transmission.
@@ -1121,24 +1104,16 @@ static void efx_remove_all(struct efx_nic *efx)
1121} 1104}
1122 1105
1123/* A convinience function to safely flush all the queues */ 1106/* A convinience function to safely flush all the queues */
1124int efx_flush_queues(struct efx_nic *efx) 1107void efx_flush_queues(struct efx_nic *efx)
1125{ 1108{
1126 int rc;
1127
1128 EFX_ASSERT_RESET_SERIALISED(efx); 1109 EFX_ASSERT_RESET_SERIALISED(efx);
1129 1110
1130 efx_stop_all(efx); 1111 efx_stop_all(efx);
1131 1112
1132 efx_fini_channels(efx); 1113 efx_fini_channels(efx);
1133 rc = efx_init_channels(efx); 1114 efx_init_channels(efx);
1134 if (rc) {
1135 efx_schedule_reset(efx, RESET_TYPE_DISABLE);
1136 return rc;
1137 }
1138 1115
1139 efx_start_all(efx); 1116 efx_start_all(efx);
1140
1141 return 0;
1142} 1117}
1143 1118
1144/************************************************************************** 1119/**************************************************************************
@@ -1311,7 +1286,6 @@ static int efx_net_open(struct net_device *net_dev)
1311static int efx_net_stop(struct net_device *net_dev) 1286static int efx_net_stop(struct net_device *net_dev)
1312{ 1287{
1313 struct efx_nic *efx = netdev_priv(net_dev); 1288 struct efx_nic *efx = netdev_priv(net_dev);
1314 int rc;
1315 1289
1316 EFX_LOG(efx, "closing %s on CPU %d\n", net_dev->name, 1290 EFX_LOG(efx, "closing %s on CPU %d\n", net_dev->name,
1317 raw_smp_processor_id()); 1291 raw_smp_processor_id());
@@ -1319,9 +1293,7 @@ static int efx_net_stop(struct net_device *net_dev)
1319 /* Stop the device and flush all the channels */ 1293 /* Stop the device and flush all the channels */
1320 efx_stop_all(efx); 1294 efx_stop_all(efx);
1321 efx_fini_channels(efx); 1295 efx_fini_channels(efx);
1322 rc = efx_init_channels(efx); 1296 efx_init_channels(efx);
1323 if (rc)
1324 efx_schedule_reset(efx, RESET_TYPE_DISABLE);
1325 1297
1326 return 0; 1298 return 0;
1327} 1299}
@@ -1404,16 +1376,10 @@ static int efx_change_mtu(struct net_device *net_dev, int new_mtu)
1404 1376
1405 efx_fini_channels(efx); 1377 efx_fini_channels(efx);
1406 net_dev->mtu = new_mtu; 1378 net_dev->mtu = new_mtu;
1407 rc = efx_init_channels(efx); 1379 efx_init_channels(efx);
1408 if (rc)
1409 goto fail;
1410 1380
1411 efx_start_all(efx); 1381 efx_start_all(efx);
1412 return rc; 1382 return rc;
1413
1414 fail:
1415 efx_schedule_reset(efx, RESET_TYPE_DISABLE);
1416 return rc;
1417} 1383}
1418 1384
1419static int efx_set_mac_address(struct net_device *net_dev, void *data) 1385static int efx_set_mac_address(struct net_device *net_dev, void *data)
@@ -1588,22 +1554,19 @@ static int efx_reset_up(struct efx_nic *efx, struct ethtool_cmd *ecmd)
1588{ 1554{
1589 int rc; 1555 int rc;
1590 1556
1591 rc = efx_init_channels(efx); 1557 efx_init_channels(efx);
1592 if (rc)
1593 goto fail1;
1594 1558
1595 /* Restore MAC and PHY settings. */ 1559 /* Restore MAC and PHY settings. */
1596 rc = falcon_xmac_set_settings(efx, ecmd); 1560 rc = falcon_xmac_set_settings(efx, ecmd);
1597 if (rc) { 1561 if (rc) {
1598 EFX_ERR(efx, "could not restore PHY settings\n"); 1562 EFX_ERR(efx, "could not restore PHY settings\n");
1599 goto fail2; 1563 goto fail;
1600 } 1564 }
1601 1565
1602 return 0; 1566 return 0;
1603 1567
1604 fail2: 1568 fail:
1605 efx_fini_channels(efx); 1569 efx_fini_channels(efx);
1606 fail1:
1607 return rc; 1570 return rc;
1608} 1571}
1609 1572
@@ -2023,19 +1986,16 @@ static int efx_pci_probe_main(struct efx_nic *efx)
2023 goto fail5; 1986 goto fail5;
2024 } 1987 }
2025 1988
2026 rc = efx_init_channels(efx); 1989 efx_init_channels(efx);
2027 if (rc)
2028 goto fail6;
2029 1990
2030 rc = falcon_init_interrupt(efx); 1991 rc = falcon_init_interrupt(efx);
2031 if (rc) 1992 if (rc)
2032 goto fail7; 1993 goto fail6;
2033 1994
2034 return 0; 1995 return 0;
2035 1996
2036 fail7:
2037 efx_fini_channels(efx);
2038 fail6: 1997 fail6:
1998 efx_fini_channels(efx);
2039 efx_fini_port(efx); 1999 efx_fini_port(efx);
2040 fail5: 2000 fail5:
2041 fail4: 2001 fail4: