Commit 1f586017 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jakub Kicinski
Browse files

net: phy: Refactor fwnode_get_phy_node()



Refactor to check if the fwnode we got is correct and return if so,
otherwise do additional checks. Using same pattern in all conditionals
makes it slightly easier to read and understand.

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250430143802.3714405-1-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 320a66f8
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -3265,12 +3265,12 @@ struct fwnode_handle *fwnode_get_phy_node(const struct fwnode_handle *fwnode)

	/* Only phy-handle is used for ACPI */
	phy_node = fwnode_find_reference(fwnode, "phy-handle", 0);
	if (is_acpi_node(fwnode) || !IS_ERR(phy_node))
	if (!IS_ERR(phy_node) || is_acpi_node(fwnode))
		return phy_node;
	phy_node = fwnode_find_reference(fwnode, "phy", 0);
	if (IS_ERR(phy_node))
		phy_node = fwnode_find_reference(fwnode, "phy-device", 0);
	if (!IS_ERR(phy_node))
		return phy_node;
	return fwnode_find_reference(fwnode, "phy-device", 0);
}
EXPORT_SYMBOL_GPL(fwnode_get_phy_node);