Message ID | 20211207170030.1406601-3-colin.foster@in-advantage.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 49af6a7620c53b779572abfbfd7778e113154330 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | prepare ocelot for external interface control | expand |
On 12/7/21 9:00 AM, Colin Foster wrote: > 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> > Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
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); }