Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: mdio: remove redundant fwnode cleanup

Remove redundant fwnode cleanup in of_mdiobus_register_device()
and xpcs_plat_init_dev().

mdio_device_free() eventually calls mdio_device_release(),
which already performs fwnode_handle_put(), making the manual
cleanup unnecessary.

Combine fwnode_handle_get() with device_set_node() in
of_mdiobus_register_device() for clarity.

Signed-off-by: Buday Csaba <buday.csaba@prolan.hu>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/00847693daa8f7c8ff5dfa19dd35fc712fa4e2b5.1763995734.git.buday.csaba@prolan.hu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Buday Csaba and committed by
Jakub Kicinski
ce28e333 a11e0d46

+1 -7
+1 -4
drivers/net/mdio/of_mdio.c
··· 63 63 /* Associate the OF node with the device structure so it 64 64 * can be looked up later. 65 65 */ 66 - fwnode_handle_get(fwnode); 67 - device_set_node(&mdiodev->dev, fwnode); 66 + device_set_node(&mdiodev->dev, fwnode_handle_get(fwnode)); 68 67 69 68 /* All data is now stored in the mdiodev struct; register it. */ 70 69 rc = mdio_device_register(mdiodev); 71 70 if (rc) { 72 - device_set_node(&mdiodev->dev, NULL); 73 - fwnode_handle_put(fwnode); 74 71 mdio_device_free(mdiodev); 75 72 return rc; 76 73 }
-3
drivers/net/pcs/pcs-xpcs-plat.c
··· 365 365 err_clean_data: 366 366 mdiodev->dev.platform_data = NULL; 367 367 368 - fwnode_handle_put(dev_fwnode(&mdiodev->dev)); 369 - device_set_node(&mdiodev->dev, NULL); 370 - 371 368 mdio_device_free(mdiodev); 372 369 373 370 return ret;