failover: Fix error return code in net_failover_create
authorYueHaibing <yuehaibing@huawei.com>
Thu, 6 Sep 2018 13:04:12 +0000 (21:04 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 8 Sep 2018 17:28:56 +0000 (10:28 -0700)
if failover_register failed, 'err' code should be set correctly

Fixes: cfc80d9a1163 ("net: Introduce net_failover driver")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/net_failover.c

index 8524fe4fddea238cccebada127e8638be39acb2e..e964d312f4ca32acda1e13adbca0fb42b0cf465b 100644 (file)
@@ -764,8 +764,10 @@ struct failover *net_failover_create(struct net_device *standby_dev)
        netif_carrier_off(failover_dev);
 
        failover = failover_register(failover_dev, &net_failover_ops);
-       if (IS_ERR(failover))
+       if (IS_ERR(failover)) {
+               err = PTR_ERR(failover);
                goto err_failover_register;
+       }
 
        return failover;