failover: Fix error return code in net_failover_create

if failover_register failed, 'err' code should be set correctly

Fixes: cfc80d9a11 ("net: Introduce net_failover driver")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
YueHaibing 2018-09-06 21:04:12 +08:00 committed by David S. Miller
parent cc577b01ba
commit 09317da317
1 changed files with 3 additions and 1 deletions

View 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;