net: mii_timestamper: fix static allocation by PHY driver
[sfrench/cifs-2.6.git] / drivers / of / of_mdio.c
index db0ed5879803f4c50b748a413905464c8db00ca6..8270bbf505fbe4d873b7a67d17ffc07daeac3da6 100644 (file)
@@ -124,7 +124,13 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio,
                of_node_put(child);
                return rc;
        }
-       phy->mii_ts = mii_ts;
+
+       /* phy->mii_ts may already be defined by the PHY driver. A
+        * mii_timestamper probed via the device tree will still have
+        * precedence.
+        */
+       if (mii_ts)
+               phy->mii_ts = mii_ts;
 
        dev_dbg(&mdio->dev, "registered phy %pOFn at address %i\n",
                child, addr);