netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Jeremy Linton <jeremy.linton@arm.com>
Cc: netdev@vger.kernel.org, mw@semihalf.com, davem@davemloft.net,
	kuba@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: mvpp2: Check for null pcs in mvpp2_acpi_start()
Date: Fri, 11 Feb 2022 23:49:39 +0000	[thread overview]
Message-ID: <Ygb2E1DGYVBO+mNP@shell.armlinux.org.uk> (raw)
In-Reply-To: <20220211234235.3180025-1-jeremy.linton@arm.com>

On Fri, Feb 11, 2022 at 05:42:35PM -0600, Jeremy Linton wrote:
> Booting a MACCHIATObin with 5.17 the system OOPs with
> a null pointer deref when the network is started. This
> is caused by the pcs->ops structure being null on this
> particular platform/firmware.

pcs->ops should never be NULL. I'm surprised this fix results in any
kind of working networking.

Instead, the initialilsation of port->pcs_*.ops needs to be moved out
of the if (!mvpp2_use_acpi_compat_mode(..)) block. Please try this:

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index b45cc7bfcdb5..0fb65940c0a5 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -7036,6 +7036,9 @@ static int mvpp2_port_probe(struct platform_device *pdev,
 	dev->max_mtu = MVPP2_BM_JUMBO_PKT_SIZE;
 	dev->dev.of_node = port_node;
 
+	port->pcs_gmac.ops = &mvpp2_phylink_gmac_pcs_ops;
+	port->pcs_xlg.ops = &mvpp2_phylink_xlg_pcs_ops;
+
 	if (!mvpp2_use_acpi_compat_mode(port_fwnode)) {
 		port->phylink_config.dev = &dev->dev;
 		port->phylink_config.type = PHYLINK_NETDEV;
@@ -7106,9 +7109,6 @@ static int mvpp2_port_probe(struct platform_device *pdev,
 				  port->phylink_config.supported_interfaces);
 		}
 
-		port->pcs_gmac.ops = &mvpp2_phylink_gmac_pcs_ops;
-		port->pcs_xlg.ops = &mvpp2_phylink_xlg_pcs_ops;
-
 		phylink = phylink_create(&port->phylink_config, port_fwnode,
 					 phy_mode, &mvpp2_phylink_ops);
 		if (IS_ERR(phylink)) {

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2022-02-11 23:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11 23:42 [PATCH] net: mvpp2: Check for null pcs in mvpp2_acpi_start() Jeremy Linton
2022-02-11 23:49 ` Russell King (Oracle) [this message]
2022-02-12  0:18   ` Jeremy Linton
2022-02-12  9:58     ` Russell King (Oracle)

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=Ygb2E1DGYVBO+mNP@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=davem@davemloft.net \
    --cc=jeremy.linton@arm.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mw@semihalf.com \
    --cc=netdev@vger.kernel.org \
    /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).