Skip to content

Commit

Permalink
net: emaclite: Fix position of lp->mii_bus assignment
Browse files Browse the repository at this point in the history
To ensure MDIO bus is not double freed in remove() path
assign lp->mii_bus after MDIO bus registration.

Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Radhey Shyam Pandey authored and David S. Miller committed Jun 15, 2018
1 parent 4fd44a9 commit 087fca5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/xilinx/xilinx_emaclite.c
Original file line number Diff line number Diff line change
Expand Up @@ -863,14 +863,14 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev)
bus->write = xemaclite_mdio_write;
bus->parent = dev;

lp->mii_bus = bus;

rc = of_mdiobus_register(bus, np);
if (rc) {
dev_err(dev, "Failed to register mdio bus.\n");
goto err_register;
}

lp->mii_bus = bus;

return 0;

err_register:
Expand Down

0 comments on commit 087fca5

Please sign in to comment.