net: stmmac: Fallback to dev_fwnode() if needed
authorJose Abreu <Jose.Abreu@synopsys.com>
Mon, 9 Mar 2020 08:36:22 +0000 (09:36 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 10 Mar 2020 03:13:16 +0000 (20:13 -0700)
When CONFIG_OF is not enabled, of_fwnode_handle() will return NULL, even
though we can have a FW handle from a given device.

Fallback to dev_fwnode() helper if needed.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index cf184241b85e9a58a589a8c7a48801465e7ad5ce..8e555f4e82d71a2517c295c75afa83f60d9b69fc 100644 (file)
@@ -1043,6 +1043,9 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
        priv->phylink_config.dev = &priv->dev->dev;
        priv->phylink_config.type = PHYLINK_NETDEV;
 
+       if (!fwnode)
+               fwnode = dev_fwnode(priv->device);
+
        phylink = phylink_create(&priv->phylink_config, fwnode,
                                 mode, &stmmac_phylink_mac_ops);
        if (IS_ERR(phylink))