phy: mvebu-cp110-comphy: fix port check in ->xlate()
authorMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 8 Jan 2019 16:31:18 +0000 (17:31 +0100)
committerKishon Vijay Abraham I <kishon@ti.com>
Thu, 7 Feb 2019 05:40:46 +0000 (11:10 +0530)
So far the PHY ->xlate() callback was checking if the port was
"invalid" before continuing, meaning that the port has not been used
yet. This check is not correct as there is no opposite call to
->xlate() once the PHY is released by the user and the port will
remain "valid" after the first phy_get()/phy_put() calls. Hence, if
this driver is built as a module, inserted, removed and inserted
again, the PHY will appear busy and the second probe will fail.

To fix this, just drop the faulty check and instead verify that the
port number is valid (ie. in the possible range).

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
drivers/phy/marvell/phy-mvebu-cp110-comphy.c

index 187cccd..d98e045 100644 (file)
@@ -580,8 +580,6 @@ static struct phy *mvebu_comphy_xlate(struct device *dev,
                return phy;
 
        lane = phy_get_drvdata(phy);
-       if (lane->port >= 0)
-               return ERR_PTR(-EBUSY);
        lane->port = args->args[0];
 
        return phy;