linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: dp83869: Reset return variable if PHY strap is read
@ 2020-06-05 20:51 Dan Murphy
  2020-06-05 21:12 ` Florian Fainelli
  2020-06-06 22:54 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Murphy @ 2020-06-05 20:51 UTC (permalink / raw)
  To: andrew, f.fainelli, hkallweit1, davem, kuba
  Cc: linux, netdev, linux-kernel, 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")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 drivers/net/phy/dp83869.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c
index df85ae5b79e4..53ed3abc26c9 100644
--- a/drivers/net/phy/dp83869.c
+++ b/drivers/net/phy/dp83869.c
@@ -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",
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: dp83869: Reset return variable if PHY strap is read
  2020-06-05 20:51 [PATCH net] net: dp83869: Reset return variable if PHY strap is read Dan Murphy
@ 2020-06-05 21:12 ` Florian Fainelli
  2020-06-06 22:54 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2020-06-05 21:12 UTC (permalink / raw)
  To: Dan Murphy, andrew, hkallweit1, davem, kuba; +Cc: linux, netdev, linux-kernel



On 6/5/2020 1:51 PM, Dan Murphy wrote:
> 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")
> Signed-off-by: Dan Murphy <dmurphy@ti.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: dp83869: Reset return variable if PHY strap is read
  2020-06-05 20:51 [PATCH net] net: dp83869: Reset return variable if PHY strap is read Dan Murphy
  2020-06-05 21:12 ` Florian Fainelli
@ 2020-06-06 22:54 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-06-06 22:54 UTC (permalink / raw)
  To: dmurphy; +Cc: andrew, f.fainelli, hkallweit1, kuba, linux, netdev, linux-kernel

From: Dan Murphy <dmurphy@ti.com>
Date: Fri, 5 Jun 2020 15:51:03 -0500

> 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")
> Signed-off-by: Dan Murphy <dmurphy@ti.com>

Applied, thank you.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-06 22:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-05 20:51 [PATCH net] net: dp83869: Reset return variable if PHY strap is read Dan Murphy
2020-06-05 21:12 ` Florian Fainelli
2020-06-06 22:54 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).