diff options
-rw-r--r-- | net/dsa/dsa.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 392e29a0227d..b445d492c115 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
@@ -630,7 +630,7 @@ static int dsa_of_probe(struct device *dev) | |||
630 | continue; | 630 | continue; |
631 | 631 | ||
632 | cd->sw_addr = be32_to_cpup(sw_addr); | 632 | cd->sw_addr = be32_to_cpup(sw_addr); |
633 | if (cd->sw_addr > PHY_MAX_ADDR) | 633 | if (cd->sw_addr >= PHY_MAX_ADDR) |
634 | continue; | 634 | continue; |
635 | 635 | ||
636 | if (!of_property_read_u32(child, "eeprom-length", &eeprom_len)) | 636 | if (!of_property_read_u32(child, "eeprom-length", &eeprom_len)) |
@@ -642,6 +642,8 @@ static int dsa_of_probe(struct device *dev) | |||
642 | continue; | 642 | continue; |
643 | 643 | ||
644 | port_index = be32_to_cpup(port_reg); | 644 | port_index = be32_to_cpup(port_reg); |
645 | if (port_index >= DSA_MAX_PORTS) | ||
646 | break; | ||
645 | 647 | ||
646 | port_name = of_get_property(port, "label", NULL); | 648 | port_name = of_get_property(port, "label", NULL); |
647 | if (!port_name) | 649 | if (!port_name) |
@@ -666,8 +668,6 @@ static int dsa_of_probe(struct device *dev) | |||
666 | goto out_free_chip; | 668 | goto out_free_chip; |
667 | } | 669 | } |
668 | 670 | ||
669 | if (port_index == DSA_MAX_PORTS) | ||
670 | break; | ||
671 | } | 671 | } |
672 | } | 672 | } |
673 | 673 | ||