netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v1 1/2] net: dsa: microchip: fix devicetree parsing of cpu node
@ 2020-12-05 15:28 Sven Van Asbroeck
  2020-12-05 15:28 ` [PATCH net v1 2/2] net: dsa: microchip: improve port count comments Sven Van Asbroeck
  2020-12-08 15:33 ` [PATCH net v1 1/2] net: dsa: microchip: fix devicetree parsing of cpu node Sven Van Asbroeck
  0 siblings, 2 replies; 7+ messages in thread
From: Sven Van Asbroeck @ 2020-12-05 15:28 UTC (permalink / raw)
  To: Woojung Huh, Microchip Linux Driver Support, Andrew Lunn,
	Vivien Didelot, Florian Fainelli, Vladimir Oltean, David S Miller,
	Jakub Kicinski
  Cc: Sven Van Asbroeck, Helmut Grohne, netdev, linux-kernel

From: Sven Van Asbroeck <thesven73@gmail.com>

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 <thesven73@gmail.com> # ksz8795
Signed-off-by: Sven Van Asbroeck <thesven73@gmail.com>
---

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

To: Woojung Huh <woojung.huh@microchip.com>
To: Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>
To: Andrew Lunn <andrew@lunn.ch>
To: Vivien Didelot <vivien.didelot@gmail.com>
To: Florian Fainelli <f.fainelli@gmail.com>
To: Vladimir Oltean <olteanv@gmail.com>
To: "David S. Miller" <davem@davemloft.net>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Helmut Grohne <helmut.grohne@intenta.de>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-12-08 20:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-05 15:28 [PATCH net v1 1/2] net: dsa: microchip: fix devicetree parsing of cpu node Sven Van Asbroeck
2020-12-05 15:28 ` [PATCH net v1 2/2] net: dsa: microchip: improve port count comments Sven Van Asbroeck
2020-12-07 23:31   ` Andrew Lunn
2020-12-08  2:16     ` Jakub Kicinski
2020-12-08 15:33 ` [PATCH net v1 1/2] net: dsa: microchip: fix devicetree parsing of cpu node Sven Van Asbroeck
2020-12-08 16:52   ` Jakub Kicinski
2020-12-08 18:42     ` Sven Van Asbroeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).