ibmvnic: Correct return code checking for ibmvnic_init during probe
authorNathan Fontenot <nfont@linux.vnet.ibm.com>
Wed, 21 Jun 2017 20:41:02 +0000 (15:41 -0500)
committerDavid S. Miller <davem@davemloft.net>
Thu, 22 Jun 2017 15:32:26 +0000 (11:32 -0400)
The update to ibmvnic_init to allow an EAGAIN return code broke
the calling of ibmvnic_init from ibmvnic_probe. The code now
will return from this point in the probe routine if anything
other than EAGAIN is returned. The check should be to see if rc
is non-zero and not equal to EAGAIN.

Without this fix, the vNIC driver can return 0 (success) from
its probe routine due to ibmvnic_init returning zero, but before
completing the probe process and registering with the netdev layer.

Fixes: 6a2fb0e99f9c (ibmvnic: driver initialization for kdump/kexec)
Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/ibmvnic.c

index aab69dd018d4c811cc81ecf876cb4b06419e101b..87db1eb5cc444d168643ba6f3c67652d5b3ec83f 100644 (file)
@@ -3726,7 +3726,7 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id)
 
        do {
                rc = ibmvnic_init(adapter);
-               if (rc != EAGAIN) {
+               if (rc && rc != EAGAIN) {
                        free_netdev(netdev);
                        return rc;
                }