net: phy: test the right variable in phy_write_mmd()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 14 Apr 2017 19:10:41 +0000 (22:10 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Apr 2017 19:10:42 +0000 (15:10 -0400)
This is a copy and paste buglet.  We meant to test for ->write_mmd but
we test for ->read_mmd.

Fixes: 1ee6b9bc6206 ("net: phy: make phy_(read|write)_mmd() generic MMD accessors")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy-core.c

index 357a4d0d7641ea6db47dca1048ad8452fb9ea99e..6739b738bbaf3277153015a7a91707c75a92f085 100644 (file)
@@ -76,7 +76,7 @@ int phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val)
        if (regnum > (u16)~0 || devad > 32)
                return -EINVAL;
 
-       if (phydev->drv->read_mmd) {
+       if (phydev->drv->write_mmd) {
                ret = phydev->drv->write_mmd(phydev, devad, regnum, val);
        } else if (phydev->is_c45) {
                u32 addr = MII_ADDR_C45 | (devad << 16) | (regnum & 0xffff);