[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211204115640.4wa4jhy3look7nkh@skbuf>
Date: Sat, 4 Dec 2021 11:56:41 +0000
From: Vladimir Oltean <vladimir.oltean@....com>
To: Colin Foster <colin.foster@...advantage.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Claudiu Manoil <claudiu.manoil@....com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
"UNGLinuxDriver@...rochip.com" <UNGLinuxDriver@...rochip.com>,
Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Russell King <linux@...linux.org.uk>
Subject: Re: [PATCH v2 net-next 2/5] net: dsa: ocelot: felix: Remove
requirement for PCS in felix devices
On Fri, Dec 03, 2021 at 05:00:47PM -0800, 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@...advantage.com>
> ---
Actually, it looks like split pcs ops (via struct phylink_pcs) are the
future, and since the vsc7512 still has a PCS1G block, you should still
consider creating a phylink_pcs for it, and then this patch won't be
needed. But anyway, to make some progress, this shouldn't hurt right now.
Reviewed-by: Vladimir Oltean <vladimir.oltean@....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
>
Powered by blists - more mailing lists