Skip to content

Commit 76b63da

Browse files
committed
Merge branch 'dsa-of-parsing-fixes'
Florian Fainelli says: ==================== net: dsa: OF parsing fixes This patch series fixes two small parsing issues, the first one was reported by Dan, the second came after looking more closely at the code. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 2ee9401 + c8cf89f commit 76b63da

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

net/dsa/dsa.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ static int dsa_of_probe(struct device *dev)
630630
continue;
631631

632632
cd->sw_addr = be32_to_cpup(sw_addr);
633-
if (cd->sw_addr > PHY_MAX_ADDR)
633+
if (cd->sw_addr >= PHY_MAX_ADDR)
634634
continue;
635635

636636
if (!of_property_read_u32(child, "eeprom-length", &eeprom_len))
@@ -642,6 +642,8 @@ static int dsa_of_probe(struct device *dev)
642642
continue;
643643

644644
port_index = be32_to_cpup(port_reg);
645+
if (port_index >= DSA_MAX_PORTS)
646+
break;
645647

646648
port_name = of_get_property(port, "label", NULL);
647649
if (!port_name)
@@ -666,8 +668,6 @@ static int dsa_of_probe(struct device *dev)
666668
goto out_free_chip;
667669
}
668670

669-
if (port_index == DSA_MAX_PORTS)
670-
break;
671671
}
672672
}
673673

0 commit comments

Comments
 (0)