diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index d4a64dbde31573329c87e25587e42ff3a6c603ae..88fa0779e0bc9278502ca8b0d84c55fded3020d4 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -432,7 +432,7 @@ int ksz_switch_register(struct ksz_device *dev, if (of_property_read_u32(port, "reg", &port_num)) continue; - if (port_num >= dev->port_cnt) + if (port_num >= dev->mib_port_cnt) return -EINVAL; of_get_phy_mode(port, &dev->ports[port_num].interface);