net: bcmgenet: disable clock before register_netdev
As soon as register_netdev() is called, the network device notifiers are running which means that other parts of the kernel, or user-space programs can call the network device ndo_open() callback and use the interface. Disable the Ethernet device clock before we register the network device such that we do not create the following situation: CPU0 CPU1 register_netdev() bcmgenet_open() clk_prepare_enable() clk_disable_unprepare() and leave the hardware block gated off, while we think it should be gated on. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
16f62d9bed
commit
0f50ce96b7
1 changed files with 4 additions and 4 deletions
|
@ -2535,14 +2535,14 @@ static int bcmgenet_probe(struct platform_device *pdev)
|
|||
netif_set_real_num_tx_queues(priv->dev, priv->hw_params->tx_queues + 1);
|
||||
netif_set_real_num_rx_queues(priv->dev, priv->hw_params->rx_queues + 1);
|
||||
|
||||
err = register_netdev(dev);
|
||||
if (err)
|
||||
goto err_clk_disable;
|
||||
|
||||
/* Turn off the main clock, WOL clock is handled separately */
|
||||
if (!IS_ERR(priv->clk))
|
||||
clk_disable_unprepare(priv->clk);
|
||||
|
||||
err = register_netdev(dev);
|
||||
if (err)
|
||||
goto err;
|
||||
|
||||
return err;
|
||||
|
||||
err_clk_disable:
|
||||
|
|
Loading…
Reference in a new issue