bnx2x: Add known PHY type check
authorYaniv Rosner <yanivr@broadcom.com>
Mon, 28 Nov 2011 00:49:50 +0000 (00:49 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 29 Nov 2011 00:02:24 +0000 (19:02 -0500)
The populate function will fail in case an unknown external PHY is detected.

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c

index 4ffc75d..cc7dbbe 100644 (file)
@@ -11489,6 +11489,10 @@ static int bnx2x_populate_ext_phy(struct bnx2x *bp,
                return -EINVAL;
        default:
                *phy = phy_null;
+               /* In case external PHY wasn't found */
+               if ((phy_type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) &&
+                   (phy_type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN))
+                       return -EINVAL;
                return 0;
        }