From: Colin Foster <colin.foster@in-advantage.com>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Russell King <linux@armlinux.org.uk>
Subject: [PATCH v3 net-next 2/5] net: dsa: ocelot: felix: Remove requirement for PCS in felix devices
Date: Sat, 4 Dec 2021 10:21:26 -0800 [thread overview]
Message-ID: <20211204182129.1044899-3-colin.foster@in-advantage.com> (raw)
In-Reply-To: <20211204182129.1044899-1-colin.foster@in-advantage.com>
Existing felix devices all have an initialized pcs array. Future devices
might not, so running a NULL check on the array before dereferencing it
will allow those future drivers to not crash at this point
Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
---
drivers/net/dsa/ocelot/felix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index 0e102caddb73..4ead3ebe947b 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -828,7 +828,7 @@ static void felix_phylink_mac_config(struct dsa_switch *ds, int port,
struct felix *felix = ocelot_to_felix(ocelot);
struct dsa_port *dp = dsa_to_port(ds, port);
- if (felix->pcs[port])
+ if (felix->pcs && felix->pcs[port])
phylink_set_pcs(dp->pl, &felix->pcs[port]->pcs);
}
--
2.25.1
next prev parent reply other threads:[~2021-12-04 18:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-04 18:21 [PATCH v3 net-next 0/5] prepare ocelot for external interface control Colin Foster
2021-12-04 18:21 ` [PATCH v3 net-next 1/5] net: dsa: ocelot: remove unnecessary pci_bar variables Colin Foster
2021-12-04 18:21 ` Colin Foster [this message]
2021-12-04 18:21 ` [PATCH v3 net-next 3/5] net: dsa: ocelot: felix: add interface for custom regmaps Colin Foster
2021-12-04 18:21 ` [PATCH v3 net-next 4/5] net: mscc: ocelot: split register definitions to a separate file Colin Foster
2021-12-04 18:21 ` [PATCH v3 net-next 5/5] net: mscc: ocelot: expose ocelot wm functions Colin Foster
2021-12-04 18:23 ` [PATCH v3 net-next 0/5] prepare ocelot for external interface control Colin Foster
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=20211204182129.1044899-3-colin.foster@in-advantage.com \
--to=colin.foster@in-advantage.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@nxp.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
all inboxes | Powered by JetHome®