Skip to content

Commit 343a8d1

Browse files
Casey Leedomdavem330
authored andcommitted
cxgb4vf: recover from failure in cxgb4vf_open()
If the Link Start fails in cxgb4vf_open(), we need to back out any state that we've built up ... Signed-off-by: Casey Leedom <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 60dbb01 commit 343a8d1

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/net/cxgb4vf/cxgb4vf_main.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -749,13 +749,19 @@ static int cxgb4vf_open(struct net_device *dev)
749749
netif_set_real_num_tx_queues(dev, pi->nqsets);
750750
err = netif_set_real_num_rx_queues(dev, pi->nqsets);
751751
if (err)
752-
return err;
753-
set_bit(pi->port_id, &adapter->open_device_map);
752+
goto err_unwind;
754753
err = link_start(dev);
755754
if (err)
756-
return err;
755+
goto err_unwind;
756+
757757
netif_tx_start_all_queues(dev);
758+
set_bit(pi->port_id, &adapter->open_device_map);
758759
return 0;
760+
761+
err_unwind:
762+
if (adapter->open_device_map == 0)
763+
adapter_down(adapter);
764+
return err;
759765
}
760766

761767
/*
@@ -764,13 +770,12 @@ static int cxgb4vf_open(struct net_device *dev)
764770
*/
765771
static int cxgb4vf_stop(struct net_device *dev)
766772
{
767-
int ret;
768773
struct port_info *pi = netdev_priv(dev);
769774
struct adapter *adapter = pi->adapter;
770775

771776
netif_tx_stop_all_queues(dev);
772777
netif_carrier_off(dev);
773-
ret = t4vf_enable_vi(adapter, pi->viid, false, false);
778+
t4vf_enable_vi(adapter, pi->viid, false, false);
774779
pi->link_cfg.link_ok = 0;
775780

776781
clear_bit(pi->port_id, &adapter->open_device_map);

0 commit comments

Comments
 (0)