[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220118024007.1950576-52-sashal@kernel.org>
Date: Mon, 17 Jan 2022 21:39:03 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Colin Foster <colin.foster@...advantage.com>,
Vladimir Oltean <vladimir.oltean@....com>,
Florian Fainelli <f.fainelli@...il.com>,
Jakub Kicinski <kuba@...nel.org>,
Sasha Levin <sashal@...nel.org>, claudiu.manoil@....com,
alexandre.belloni@...tlin.com, UNGLinuxDriver@...rochip.com,
andrew@...n.ch, vivien.didelot@...il.com, davem@...emloft.net,
linux@...linux.org.uk, netdev@...r.kernel.org
Subject: [PATCH AUTOSEL 5.10 052/116] net: dsa: ocelot: felix: Remove requirement for PCS in felix devices
From: Colin Foster <colin.foster@...advantage.com>
[ Upstream commit 49af6a7620c53b779572abfbfd7778e113154330 ]
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@...advantage.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@....com>
Reviewed-by: Florian Fainelli <f.fainelli@...il.com>
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
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 4e53464411edf..c1105bd7cf67b 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -204,7 +204,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.34.1
Powered by blists - more mailing lists