linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sven Van Asbroeck <thesven73@gmail.com>
To: Woojung Huh <woojung.huh@microchip.com>,
	Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	David S Miller <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: Sven Van Asbroeck <thesven73@gmail.com>,
	Helmut Grohne <helmut.grohne@intenta.de>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net v1 1/2] net: dsa: microchip: fix devicetree parsing of cpu node
Date: Sat,  5 Dec 2020 10:28:13 -0500	[thread overview]
Message-ID: <20201205152814.7867-1-TheSven73@gmail.com> (raw)

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


             reply	other threads:[~2020-12-05 18:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-05 15:28 Sven Van Asbroeck [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201205152814.7867-1-TheSven73@gmail.com \
    --to=thesven73@gmail.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=helmut.grohne@intenta.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=vivien.didelot@gmail.com \
    --cc=woojung.huh@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).