Skip to contentSkip to conversation

of_mdio: kill useless variable in of_phy_register_fixed_link()

PATCH In review Sergei Shtylyov 2 participants 2 messages Jul 23, 2017 – Jul 24, 2017 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 of_mdio: kill useless variable in of_phy_register_fixed_link()

of_phy_register_fixed_link() declares the 'err' variable to hold the result of of_property_read_string() but only uses it once after that, while that function can be called directly from the *if* statement...

Remove that variable and move/regroup 'link_gpio' and 'len' variables in order to sort the declarations in the reverse Xmas tree order -- to please DaveM. ;-)

---
 drivers/of/of_mdio.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/of/of_mdio.c +2 -4
Index: linux/drivers/of/of_mdio.c
===================================================================
@@ -422,13 +422,11 @@ int of_phy_register_fixed_link(struct de
 	struct fixed_phy_status status = {};
 	struct device_node *fixed_link_node;
 	const __be32 *fixed_link_prop;
-	int link_gpio;
-	int len, err;
 	struct phy_device *phy;
 	const char *managed;
+	int link_gpio, len;
 
-	err = of_property_read_string(np, "managed", &managed);
-	if (err == 0) {
+	if (of_property_read_string(np, "managed", &managed) == 0) {
 		if (strcmp(managed, "in-band-status") == 0) {
 			/* status is zeroed, namely its .link member */
 			phy = fixed_phy_register(PHY_POLL, &status, -1, np);

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to a message not in the archive

From: Sergei Shtylyov <sergei.shtylyov-M4DtvfQ/[email protected]>
Date: Sun, 23 Jul 2017 21:45:47 +0300

Quoted 7 lines

of_phy_register_fixed_link() declares the 'err' variable to hold the result of of_property_read_string() but only uses it once after that, while that function can be called directly from the *if* statement...

Remove that variable and move/regroup 'link_gpio' and 'len' variables in order to sort the declarations in the reverse Xmas tree order -- to please DaveM. ;-)

Respect MY AUTHORITY! :-)

Quoted 1 line

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html