Skip to contentSkip to conversation

net: phy: Uninitialized variables in yt8531_link_change_notify()

PATCH Superseded Dan Carpenter 2 participants 4 messages Feb 14, 2023 – Feb 15, 2023

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: Uninitialized variables in yt8531_link_change_notify()

These booleans are never set to false, but are just used uninitialized.

Fixes 4ac94f728a58 ("net: phy: Add driver for Motorcomm yt8531 gigabit ethernet phy")

---
Applies to net-next.

 drivers/net/phy/motorcomm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/phy/motorcomm.c +3 -3
index ee7c37dfdca0..119a54d6c65d 100644
@@ -1534,9 +1534,9 @@ static void yt8531_link_change_notify(struct phy_device *phydev)
 {
 	struct device_node *node = phydev->mdio.dev.of_node;
 	bool tx_clk_adj_enabled = false;
-	bool tx_clk_1000_inverted;
-	bool tx_clk_100_inverted;
-	bool tx_clk_10_inverted;
+	bool tx_clk_1000_inverted = false;
+	bool tx_clk_100_inverted = false;
+	bool tx_clk_10_inverted = false;
 	u16 val = 0;
 	int ret;
 
Signature · 1 line
2.35.1
#1 lore raw
Quoted 7 lines · Dan Carpenter

These booleans are never set to false, but are just used uninitialized.

Fixes 4ac94f728a58 ("net: phy: Add driver for Motorcomm yt8531 gigabit ethernet phy")

---
Applies to net-next.

Sorry for sending this twice. :/

regards,
dan carpenter

maintainer
#2 lore raw
In reply to Dan Carpenter

drivers/net/phy/motorcomm.c static void yt8531_link_change_notify(struct phy_device *phydev) · line 1539

Quoted 10 lines · Dan Carpenter
drivers/net/phy/motorcomm.c +3 -3
@@ -1534,9 +1534,9 @@ static void yt8531_link_change_notify(struct phy_device *phydev)
 {
 	struct device_node *node = phydev->mdio.dev.of_node;
 	bool tx_clk_adj_enabled = false;
-	bool tx_clk_1000_inverted;
-	bool tx_clk_100_inverted;
-	bool tx_clk_10_inverted;
+	bool tx_clk_1000_inverted = false;
+	bool tx_clk_100_inverted = false;
+	bool tx_clk_10_inverted = false;

Thanks, please keep reverse christmas tree.

Quoted 3 lines
drivers/net/phy/motorcomm.c +0 -0
 	u16 val = 0;
 	int ret;
 
#3 lore raw
Quoted 4 lines · Frank Sae

On 2023/2/14 23:48, Dan Carpenter wrote:

Quoted 13 lines

drivers/net/phy/motorcomm.c static void yt8531_link_change_notify(struct phy_device *phydev) · line 1539

Quoted 10 lines
drivers/net/phy/motorcomm.c +3 -3
@@ -1534,9 +1534,9 @@ static void yt8531_link_change_notify(struct phy_device *phydev)
 {
 	struct device_node *node = phydev->mdio.dev.of_node;
 	bool tx_clk_adj_enabled = false;
-	bool tx_clk_1000_inverted;
-	bool tx_clk_100_inverted;
-	bool tx_clk_10_inverted;
+	bool tx_clk_1000_inverted = false;
+	bool tx_clk_100_inverted = false;
+	bool tx_clk_10_inverted = false;

Thanks, please keep reverse christmas tree.

Right. Good point.

regards,
dan carpenter