fsl/fman: check pcsphy pointer before use
authorMadalin Bucur <madalin.bucur@nxp.com>
Tue, 28 Jun 2016 12:32:44 +0000 (15:32 +0300)
committerMadalin Bucur <madalin.bucur@nxp.com>
Tue, 4 Oct 2016 06:26:08 +0000 (09:26 +0300)
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
drivers/net/ethernet/freescale/fman/fman_memac.c

index 96dfe7eb4e5fe8cdb614afcd38f53bdaa82a5ade..53ef51e3bd9ef2cb3c5f8100f807399ab36a31d1 100644 (file)
@@ -507,6 +507,9 @@ static void setup_sgmii_internal_phy(struct fman_mac *memac,
 {
        u16 tmp_reg16;
 
+       if (WARN_ON(!memac->pcsphy))
+               return;
+
        /* SGMII mode */
        tmp_reg16 = IF_MODE_SGMII_EN;
        if (!fixed_link)