]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: phy: dp83867: Fix a never true comparison
authorHaolin Li <li.haolin@qq.com>
Sat, 19 Mar 2022 14:02:42 +0000 (07:02 -0700)
committerRamon Fried <ramon@neureality.ai>
Sun, 10 Apr 2022 05:44:12 +0000 (08:44 +0300)
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>
drivers/net/phy/dp83867.c

index 49978d0f25f3948dddf915d3f1a0927c4ed72537..3d862636b6b274e45e8fe607ec5709d08f1f243f 100644 (file)
@@ -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);