ibmvnic: Validate napi exist before disabling them

Validate that the napi structs exist before trying to disable them
at driver close.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Nathan Fontenot 2017-04-21 15:39:10 -04:00 committed by David S. Miller
parent 53da09e929
commit 3ca1993264
1 changed files with 4 additions and 2 deletions

View File

@ -729,8 +729,10 @@ static int ibmvnic_close(struct net_device *netdev)
adapter->closing = true;
disable_sub_crqs(adapter);
for (i = 0; i < adapter->req_rx_queues; i++)
napi_disable(&adapter->napi[i]);
if (adapter->napi) {
for (i = 0; i < adapter->req_rx_queues; i++)
napi_disable(&adapter->napi[i]);
}
if (!adapter->failover)
netif_tx_stop_all_queues(netdev);