From: Sven Van Asbroeck <[email protected]>

On the ksz8795, if the devicetree contains a cpu node,
devicetree parsing fails and the whole driver errors out.

Fix the devicetree parsing code by making it use the
correct number of ports.

Fixes: 912aae27c6af ("net: dsa: microchip: really look for phy-mode in port 
nodes")
Tested-by: Sven Van Asbroeck <[email protected]> # ksz8795
Signed-off-by: Sven Van Asbroeck <[email protected]>
---

Tree: git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git # 905b2032fa42

To: Woojung Huh <[email protected]>
To: Microchip Linux Driver Support <[email protected]>
To: Andrew Lunn <[email protected]>
To: Vivien Didelot <[email protected]>
To: Florian Fainelli <[email protected]>
To: Vladimir Oltean <[email protected]>
To: "David S. Miller" <[email protected]>
To: Jakub Kicinski <[email protected]>
Cc: Helmut Grohne <[email protected]>
Cc: [email protected]
Cc: [email protected]

 drivers/net/dsa/microchip/ksz_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/microchip/ksz_common.c 
b/drivers/net/dsa/microchip/ksz_common.c
index e5f047129b15..17b804c44c53 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -431,7 +431,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->ds->num_ports)
                                        return -EINVAL;
                                of_get_phy_mode(port,
                                                
&dev->ports[port_num].interface);
-- 
2.17.1

Reply via email to