Skip to contentSkip to conversation

net: dp83869: Reset return variable if PHY strap is read

PATCH Applied Dan Murphy 3 participants 3 messages Jun 5, 2020 – Jun 6, 2020

Subsystems (3)
lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

PATCH 1/1 net: dp83869: Reset return variable if PHY strap is read

When the PHY's strap register is read to determine if lane swapping is needed the phy_read_mmd returns the value back into the ret variable.

If the call to read the strap fails the failed value is returned. If the call to read the strap is successful then ret is possibly set to a non-zero positive number. Without reseting the ret value to 0 this will cause the parse DT function to return a failure.

Fixes c4566aec6e808 ("net: phy: dp83869: Update port-mirroring to read straps")
---
 drivers/net/phy/dp83869.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/phy/dp83869.c +3 -0
index df85ae5b79e4..53ed3abc26c9 100644
@@ -218,10 +218,13 @@ static int dp83869_of_init(struct phy_device *phydev)
 		ret = phy_read_mmd(phydev, DP83869_DEVADDR, DP83869_STRAP_STS1);
 		if (ret < 0)
 			return ret;
+
 		if (ret & DP83869_STRAP_MIRROR_ENABLED)
 			dp83869->port_mirroring = DP83869_PORT_MIRRORING_EN;
 		else
 			dp83869->port_mirroring = DP83869_PORT_MIRRORING_DIS;
+
+		ret = 0;
 	}
 
 	if (of_property_read_u32(of_node, "rx-fifo-depth",
Signature · 1 line
2.26.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Dan Murphy

When the PHY's strap register is read to determine if lane swapping is needed the phy_read_mmd returns the value back into the ret variable.

If the call to read the strap fails the failed value is returned. If the call to read the strap is successful then ret is possibly set to a non-zero positive number. Without reseting the ret value to 0 this will cause the parse DT function to return a failure.

Fixes c4566aec6e808 ("net: phy: dp83869: Update port-mirroring to read straps")
Signature · 1 line
Florian
maintainer Applied
#2 lore raw
In reply to Dan Murphy

From: Dan Murphy <[email protected]>
Date: Fri, 5 Jun 2020 15:51:03 -0500

Quoted 10 lines

When the PHY's strap register is read to determine if lane swapping is needed the phy_read_mmd returns the value back into the ret variable.

If the call to read the strap fails the failed value is returned. If the call to read the strap is successful then ret is possibly set to a non-zero positive number. Without reseting the ret value to 0 this will cause the parse DT function to return a failure.

Fixes c4566aec6e808 ("net: phy: dp83869: Update port-mirroring to read straps")

Applied, thank you.