staging: fsl-dpaa2/ethsw: register_netdev only when ready

The register_netdev() call should be made only when ready to process any
user request on the interface. Move the call to be the last one issued
in the probe sequence.

Reported-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1565700187-16048-10-git-send-email-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Ioana Ciornei 2019-08-13 15:43:06 +03:00 committed by Greg Kroah-Hartman
parent 38fc21369e
commit 18f1296f06
1 changed files with 6 additions and 8 deletions

View File

@ -1588,23 +1588,21 @@ static int ethsw_probe_port(struct ethsw_core *ethsw, u16 port_idx)
port_netdev->min_mtu = ETH_MIN_MTU; port_netdev->min_mtu = ETH_MIN_MTU;
port_netdev->max_mtu = ETHSW_MAX_FRAME_LENGTH; port_netdev->max_mtu = ETHSW_MAX_FRAME_LENGTH;
err = ethsw_port_init(port_priv, port_idx);
if (err)
goto err_port_probe;
err = register_netdev(port_netdev); err = register_netdev(port_netdev);
if (err < 0) { if (err < 0) {
dev_err(dev, "register_netdev error %d\n", err); dev_err(dev, "register_netdev error %d\n", err);
goto err_register_netdev; goto err_port_probe;
} }
ethsw->ports[port_idx] = port_priv; ethsw->ports[port_idx] = port_priv;
err = ethsw_port_init(port_priv, port_idx);
if (err)
goto err_ethsw_port_init;
return 0; return 0;
err_ethsw_port_init: err_port_probe:
unregister_netdev(port_netdev);
err_register_netdev:
free_netdev(port_netdev); free_netdev(port_netdev);
return err; return err;