Skip to content

Commit

Permalink
sfc: Move MTD probe after netdev registration and name allocation
Browse files Browse the repository at this point in the history
The MTD partition is named based on the netdev name, which is set to
'eth%d' before registration.  Also, the MTD partition will currently
be left registered if netdev registration fails.

Fix both these problems by moving the MTD probe after netdev
registration.  Hold the RTNL to serialise this with the netdev
notifier that calls efx_mtd_rename().

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Oct 24, 2009
1 parent 2ed380a commit a5211bb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/sfc/efx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2209,13 +2209,15 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
* MAC stats succeeds. */
efx->state = STATE_RUNNING;

efx_mtd_probe(efx); /* allowed to fail */

rc = efx_register_netdev(efx);
if (rc)
goto fail5;

EFX_LOG(efx, "initialisation successful\n");

rtnl_lock();
efx_mtd_probe(efx); /* allowed to fail */
rtnl_unlock();
return 0;

fail5:
Expand Down

0 comments on commit a5211bb

Please sign in to comment.