diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index 1357348e01d5..b8d298c04d3f 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -63,14 +63,11 @@ static int of_mdiobus_register_device(struct mii_bus *mdio, /* Associate the OF node with the device structure so it * can be looked up later. */ - fwnode_handle_get(fwnode); - device_set_node(&mdiodev->dev, fwnode); + device_set_node(&mdiodev->dev, fwnode_handle_get(fwnode)); /* All data is now stored in the mdiodev struct; register it. */ rc = mdio_device_register(mdiodev); if (rc) { - device_set_node(&mdiodev->dev, NULL); - fwnode_handle_put(fwnode); mdio_device_free(mdiodev); return rc; } diff --git a/drivers/net/pcs/pcs-xpcs-plat.c b/drivers/net/pcs/pcs-xpcs-plat.c index c422e8d8b89f..b8c48f9effbf 100644 --- a/drivers/net/pcs/pcs-xpcs-plat.c +++ b/drivers/net/pcs/pcs-xpcs-plat.c @@ -365,9 +365,6 @@ static int xpcs_plat_init_dev(struct dw_xpcs_plat *pxpcs) err_clean_data: mdiodev->dev.platform_data = NULL; - fwnode_handle_put(dev_fwnode(&mdiodev->dev)); - device_set_node(&mdiodev->dev, NULL); - mdio_device_free(mdiodev); return ret;