The macro magic to build constant bitmaps of supported PHY features breaks when we have more than 63 ETHTOOL_LINK_MODE bits. Make the breakage loud, not a subtle bug, when we get to that condition.
Signed-off-by: Andrew Lunn <and...@lunn.ch> --- drivers/net/phy/phy_device.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index eed61ee1d394..7bee59c7834b 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2297,6 +2297,13 @@ static int __init phy_init(void) { int rc; + /* The phy_basic_features, phy_gbit_features etc, above, only + * work for values up to 63. Ensure we get a loud error if + * this threshold is exceeded, and the necessary changes are + * made. + */ + BUILD_BUG_ON(__ETHTOOL_LINK_MODE_LAST > 63); + rc = mdio_bus_init(); if (rc) return rc; -- 2.19.0.rc1