aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaolin Li <li.haolin@qq.com>2022-03-19 07:02:42 -0700
committerRamon Fried <ramon@neureality.ai>2022-04-10 08:44:12 +0300
commite2b6cf5cadc0b71f4addbe0019f7da0c8578c194 (patch)
treee862afffeac1f692ea0a6a9e3d1179b4609533fc
parent5faf161d07099d25fcb67f203c5576f258a11fbf (diff)
downloadu-boot-e2b6cf5cadc0b71f4addbe0019f7da0c8578c194.zip
u-boot-e2b6cf5cadc0b71f4addbe0019f7da0c8578c194.tar.gz
u-boot-e2b6cf5cadc0b71f4addbe0019f7da0c8578c194.tar.bz2
net: phy: dp83867: Fix a never true comparison
The type of the return value of phy_read() and phy_read_mmd() is int. Change the variable to not be unsigned so that we not get into an unsigned compared against 0. Signed-off-by: Haolin Li <li.haolin@qq.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
-rw-r--r--drivers/net/phy/dp83867.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index 49978d0..3d86263 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -266,7 +266,7 @@ static int dp83867_of_init(struct phy_device *phydev)
static int dp83867_config(struct phy_device *phydev)
{
struct dp83867_private *dp83867;
- unsigned int val, delay, cfg2;
+ int val, delay, cfg2;
int ret, bs;
dp83867 = (struct dp83867_private *)phydev->priv;
@@ -291,8 +291,11 @@ static int dp83867_config(struct phy_device *phydev)
if (phy_interface_is_rgmii(phydev)) {
val = phy_read(phydev, MDIO_DEVAD_NONE, MII_DP83867_PHYCTRL);
- if (val < 0)
+ if (val < 0) {
+ ret = val;
goto err_out;
+ }
+
val &= ~DP83867_PHYCR_FIFO_DEPTH_MASK;
val |= (dp83867->fifo_depth << DP83867_PHYCR_FIFO_DEPTH_SHIFT);