Re: [PATCH] net: mvpp2: Check for null pcs in mvpp2_acpi_start()
From: Jeremy Linton <hidden>
Date: 2022-02-12 00:18:37
Also in:
lkml
Hi, On 2/11/22 17:49, Russell King (Oracle) wrote:
On Fri, Feb 11, 2022 at 05:42:35PM -0600, Jeremy Linton wrote:quoted
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:
That appears to fix it as well, shall I re-post this with your fix, or will you?
quoted hunk ↗ jump to hunk
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.
I did a bit more testing and as a side note, it seems ethtool tosses
these errors too.
netlink error: failed to retrieve link settings
netlink error: Unknown error 524
netlink error: failed to retrieve link settings
netlink error: Unknown error 524
Settings for enamrvl110i0:
Link detected: no