From: Fabrice Gasnier <fabrice.gasn...@st.com>

phy_bus_name can be NULL when "fixed-link" property isn't used.
Then, since "stmmac: do not poll phy handler when attach a switch",
phy_bus_name ptr needs to be checked before strcmp is called.

Signed-off-by: Fabrice Gasnier <fabrice.gasn...@st.com>
Signed-off-by: Giuseppe Cavallaro <peppe.cavall...@st.com>
Signed-off-by: Alexandre TORGUE <alexandre.tor...@st.com>

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index eab7ac0..3cc1355 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -868,8 +868,9 @@ static int stmmac_init_phy(struct net_device *dev)
        }
 
        /* If attached to a switch, there is no reason to poll phy handler */
-       if (!strcmp(priv->plat->phy_bus_name, "fixed"))
-               phydev->irq = PHY_IGNORE_INTERRUPT;
+       if (priv->plat->phy_bus_name)
+               if (!strcmp(priv->plat->phy_bus_name, "fixed"))
+                       phydev->irq = PHY_IGNORE_INTERRUPT;
 
        pr_debug("stmmac_init_phy:  %s: attached to PHY (UID 0x%x)"
                 " Link = %d\n", dev->name, phydev->phy_id, phydev->link);
-- 
1.9.1

Reply via email to